views:

175

answers:

1

I'm trying to make a small tool that makes use of the Debugger Engine API, but I'm having very limited success.

I can get my IDebugClient and IDebugControl instances, and from there I am able to attach into an already running user process. I then enter a main loop where I call WaitForEvent, OutputStackTrace, SetExecutionStatus(DEBUG_STATUS_GO), and repeat. In essence this will be a very crude sampling based profiler.

Good so far..

My loop runs for one full iteration, I can see a stack trace being displayed and then the target process going back into a running state.

The problem I have is that on my 2nd iteration the call to WaitForEvent returns E_HANDLE ("The handle is invalid"). I cannot see in the documentation why this error should be returned. Does anyone know why this might be happening?

A: 

The problem turned out to be that I was compiling, linking, and running against an old version of the SDK. Now that I've upgraded my SDK to the latest version (which I presume is the version that the online docs refer to) I get behaviour that is at least consistent with the docs.

I still have problems, but no longer this problem.

pauldoo