[Cvsnt] Debug the subprocess on win2k

Daniel Lohmann daniel at uni-koblenz.de
Sun Jan 27 20:02:37 GMT 2002


----- Original Message -----
From: "Jiang Benjamin" <jbenjimin at hotmail.com>
To: <cvsnt at cvsnt.org>
Sent: Sunday, January 27, 2002 5:12 PM
Subject: [Cvsnt] Debug the subprocess on win2k


> Hi, All, I am a new player here, but I finally figured out how to debug
the
> cvs subprocess spawned by cvsservice.exe.
>
> I added a DebugBreak() call in the main() in cvsnt project. Then when
> cvsservice spawned a new process with cvs.exe running in it. Windows would
> tell you that a breakpoint had been reached and asked you if you want to
> debug. You can choose to debug and bring up a new VC to debug...
> [...]
> Anyway, after installed Visual Studio 6 SP 5, I can debug the subprocess.
> The bad thing is everytime a VC IDE will be brought up and you have to put
> the breakpoint again and again. I may be able to save these setting
> somewhere.

I also use hardcoded breakpoints frequently in my apps (they are great to
debug serivces), so the following ideas may help you:

1) On Intel machines DebugBreak() does not more that calling an int 3
software interrupt. Thus by writing

_asm int 3;

(best placed in an macro) instead of DebugBreak() you could make your life a
bit easier, because you don't have to step out of the DebugBreak() call.

2) I often use a global "flag" to indicate if the debugger should be started
or not. Win32 Event objects are best for this. Write a small (GUI) app, that
creates a named manuel reset event (eg "CVSNT_Debug") and allows you to set
and clear it.
In CVSNT main() you open the event, check if it is signaled and then execute
the hardcoded breakpoint.

3) To make it even more fancier, you could let cvsnt.exe itself start the
debugger and attach to it. For this get your own PID and run "msdev.exe -P
<pid in hex>". Then wait for some seconds (to let the IDE initialize itself)
and execute the hardcoded breakpoint.

I really like the build in support for Debuggers in NT :-)

Daniel


_______________________________________________
Cvsnt mailing list
Cvsnt at cvsnt.org
http://www.cvsnt.org/cgi-bin/mailman/listinfo/cvsnt



More information about the cvsnt mailing list