Sending the Required Events
Note
This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here
Use this procedure for sending required events.
Process for Sending Required Events
The following events are required, in this order, when creating a debug engine (DE) and attaching it to a program:
Send an IDebugEngineCreateEvent2 event object to the session debug manager (SDM) when the DE is initialized for debugging one or more programs in a process.
When the program to be debugged is attached to, send an IDebugProgramCreateEvent2 event object to the SDM. This event may be a stopping event, depending on your engine design.
If the program is attached to when the process is launched, send an IDebugThreadCreateEvent2 event object to the SDM to notify the IDE of the new thread. This event may be a stopping event, depending on your engine design.
Send an IDebugLoadCompleteEvent2 event object to the SDM when the program being debugged is finished loading or when attaching to the program is completed. This event must be a stopping event.
If the application to be debugged is launched, send an IDebugEntryPointEvent2 event object to the SDM when the first instruction of code in the run-time architecture is about to be executed. This event is always a stopping event. When stepping into the debugging session, the IDE stops on this event.
Note
Many languages use global initializers or external, precompiled functions (from the CRT library or _Main) at the beginning of their code. If the language of the program you are debugging contains either of these types of elements before the initial entry point, then this code is run and the entry point event is sent when the user entry point, such as main or WinMain
, is reached.