I need my Visual Studio extension to react to debugging events. I've registered a IDebugEventCallback2
and I'm receiving events, but all I get for each event is an opaque IDebugEvent2
and a Guid, many of which are not only undocumented but don't appear anywhere on the web (or in my registry).
My specific requirement at the moment is to know when the process is Continued - ie. the user has hit Continue, Run to cursor, etc. What Guid should I be looking for?
Or is there some other event family that I should be subscribing to?
(More generally, is there some way I'm missing to find out about the events that are delivered to my IDebugEventCallback2::Event
callback, when many of them don't appear in MSDN or anywhere else? Thanks!)
There is no easy way to do this. Actions such as Continue and Run to cursor are abstractions implemented by Visual Studio and do not correspond to any unique event(s) with respect to the debug engine. The debug engine event reporting interface
IDebugEventCallback2
will enable you to get notified only on fine-grained events such as when creating a breakpoint or reaching a breakpoint.While Visual Studio enables you to perform actions such as Continue and Run to cursor programmatically, it does not provide a direct way to get notified when they are taken.
You can use EnvDTE.DebuggerEvents.OnXxx events to get notified when something is about to happen. In particular, the
OnEnterBreakMode
event enables you to intercept a breakpoint hit and possibly take an action. You can also inspect all the details of the reached breakpoint(s) using the current EnvDTE.Debugger inside the event handler.Now with some effort, you can use these constructs to implement events that correspond to all Visual Studio debugging actions including Continue and Run to cursor accurately. If you require additional events not provided by
EnvDTE.DebuggerEvents
(such as when a breakpoint is inserted), you have no choice but useIDebugEventCallback2.Event
. In this case if you have specific events in mind, please mention them explicitly and I might be able to tell you the correspondingIDebugEventCallback2.Event
GUIDs.