Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Need OutputDebugString/TRACE monitor

75 views
Skip to first unread message

Oliver Daniel

unread,
Dec 26, 1997, 3:00:00 AM12/26/97
to

Anyne know of a free/shareware utility to monitor calls to OutputDebugString
or use of the TRACE macro in MFC? I'm looking for a lightweight tool to
monitor debugging info without needing the development enviroment.

Thanks in advance
Oliver Daniel
gaun...@ziplink.net

Jean-Michel David

unread,
Dec 27, 1997, 3:00:00 AM12/27/97
to Oliver Daniel

Look for DBWin32 from Andrew Tucker: www.halcyon.com/ast/

--
----------------------------------------------
Jean-Michel David (514)948-2156
6019 Waverly jmd...@total.net
Montreal (Quebec) www.total.net/~clap
H2T 2Y4
----------------------------------------------

Dieter Schmeer

unread,
Dec 27, 1997, 3:00:00 AM12/27/97
to

Hi!

Try dbwin.zip on http://www.wdj.com/code/utilities.html
It only works with Win95, not with NT, but it includes the source code.

Dieter Schmeer


Oliver Daniel schrieb in Nachricht <681afd$4...@usenet40.supernews.com>...

Cecil A. Galbraith

unread,
Dec 28, 1997, 3:00:00 AM12/28/97
to Oliver Daniel

Oliver Daniel wrote:
>
> Anyne know of a free/shareware utility to monitor calls to OutputDebugString
> or use of the TRACE macro in MFC? I'm looking for a lightweight tool to
> monitor debugging info without needing the development enviroment.
>
> Thanks in advance
> Oliver Daniel
> gaun...@ziplink.net

There is such a thing at the URL below. It's made up of a class that you
link into your code (and can leave there in the release mode) and an EXE
that receives the output from the class. And it's free...

Cecil

--
Cecil Galbraith
CustomSoft mail to cgal...@concentric.net

Free programmer's utilities and MFC tips at
http://www.concentric.net/~cgalbrai

Mark Wright

unread,
Dec 29, 1997, 3:00:00 AM12/29/97
to

Oliver Daniel wrote in message <681afd$4...@usenet40.supernews.com>...

>Anyne know of a free/shareware utility to monitor calls to
OutputDebugString
>or use of the TRACE macro in MFC? I'm looking for a lightweight tool
to
>monitor debugging info without needing the development enviroment.


Paul DiLascia, who writes a column in Microsoft Systems Journal, wrote
just such an application - it's available at MSJ's ftp site (this
following is an self-extracting archive, which contains a bunch of
other self-extracting archives. The one you want is CPPQ1195.EXE.
Not sure why they don't just use winzip...):

ftp://ftp.microsoft.com/DEVELOPR/MSJ/MSJOCT95.EXE

It's pretty cool.
---
Mark Wright
Blue Frog Software, Inc
mwr...@pro-ns.net

Mark Wright

unread,
Dec 29, 1997, 3:00:00 AM12/29/97
to

Mark Wright wrote in message <34a81...@news1.uswest.net>...


But I just found an even cooler one. This one hooks
OutputDebugString, rather than redefining TRACE (lDiLascia's app).
Look here:
http://www.halcyon.com/ast

David Thompson

unread,
Dec 31, 1997, 3:00:00 AM12/31/97
to

Don't forget:
http://www.ntinternals.com/debugmon.htm

Only nt 4.0.

Oliver Daniel wrote in message <681afd$4...@usenet40.supernews.com>...
>Anyne know of a free/shareware utility to monitor calls to
OutputDebugString
>or use of the TRACE macro in MFC? I'm looking for a lightweight tool to
>monitor debugging info without needing the development enviroment.
>

Oliver Daniel

unread,
Jan 1, 1998, 3:00:00 AM1/1/98
to

Thank you all for the responses!

Oliver Daniel
gaun...@ziplink.net

Bibhas Bhattacharya

unread,
Jan 3, 1998, 3:00:00 AM1/3/98
to

> >
> > Anyne know of a free/shareware utility to monitor calls to
OutputDebugString
> > or use of the TRACE macro in MFC? I'm looking for a lightweight tool to
> > monitor debugging info without needing the development enviroment.
> >

Compile the following code. Run without argument for help. Only tested in
NT.

Bibhas.
bib...@interlog.com
=================

#include <windows.h>
#include <stdio.h>

void
ShowDebugString(DEBUG_EVENT* DebugEv, HANDLE hProc)
{
OUTPUT_DEBUG_STRING_INFO *pI = &(DebugEv->u.DebugString);
void* aBuff = malloc(pI->nDebugStringLength);
DWORD dRead;

if (::ReadProcessMemory(
hProc, pI->lpDebugStringData, aBuff, pI->nDebugStringLength, &dRead)
== FALSE)
{
puts("Error: can't read VM memory");
return;
}
if (pI->fUnicode == 0)
{
char *buff = (char*) aBuff;

//buff[dRead] = '\0';
printf("%s", buff);
}
else
{
//puts("OOH! UBICODE");
wchar_t *buff = (wchar_t*) aBuff;

//buff[dRead] = '\0';
wprintf(L"%s", buff);
}

::free(aBuff);
}

int
main(int argc, char* argv[])
{
if (argc < 2)
{
puts("Usage: DbgConsole processID\n"
"You can get the processID from task manager");
return 1;
}

DWORD id;
DEBUG_EVENT DebugEv; // debugging event information
DWORD dwContinueStatus = DBG_CONTINUE; // exception continuation
BOOL bCont = TRUE;
HANDLE hProc = NULL;

id = atoi(argv[1]);
if (::DebugActiveProcess(id) == FALSE)
{
printf("Can't debug process ID: %d\n", id);
return 1;
}

hProc = ::OpenProcess(PROCESS_VM_READ, FALSE, id);
if (hProc == NULL)
{
printf("Can't get VM read access from process ID: %d\n", id);
return 1;
}

while (bCont)
{

// Wait for a debugging event to occur. The second parameter indicates
// that the function does not return until a debugging event occurs.
WaitForDebugEvent(&DebugEv, INFINITE);

// Process the debugging event code.
switch (DebugEv.dwDebugEventCode)
{
case EXIT_PROCESS_DEBUG_EVENT:
bCont = FALSE;
//puts("Process exited");
break;
case OUTPUT_DEBUG_STRING_EVENT:
//puts("Got string");
::ShowDebugString(&DebugEv, hProc);
break;
}

// Resume executing the thread that reported the debugging event.
ContinueDebugEvent(DebugEv.dwProcessId,
DebugEv.dwThreadId, dwContinueStatus);

}

::CloseHandle(hProc);

return 0;
}


0 new messages