DebugSetProcessKillOnExit and Win32 processes on x64

| 0 Comments

I spent a little time looking at an x64 port of my debugging tools library at the weekend. Since this requires me to set breakpoints and manipulate process memory and image files and all sorts I expected it to be a little more complex to port than the higher level sockets code and the bulk of my Win32 code. So far things are going reasonably well, but I've just come across a strangeness with DebugSetProcessKillOnExit(TRUE) in an x86 debugger that's running an x86 process on an x64 machine. It seems like when the debug thread terminates the debugged process doesn't get terminated, it should do, but it doesn't... :(

What's more, changing my code to terminate the process forcibly, with TerminateProcess() if my wait for the debugged process to terminate cleanly times out also fails... The call to TerminateProcess() returns without error but the process is still alive and remains that way until the debugger process itself terminates...

My current best guess is that my code is subtly broken and there's a race condition being exposed on my x64 box that never shows up (the tests don't fail) on my x86 box...

Leave a comment