共用方式為


Send startup events after a launch

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. 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

Once the debug engine (DE) is attached to the program, it sends a series of startup events back to the debug session.

Startup events sent back to the debug session include:

  • An engine creation event.

  • A program creation event.

  • Thread creation and module load events.

  • A load complete event, sent when the code is loaded and ready to run, but before any code is executed.

    Note

    When this event is continued, global variables are initialized and startup routines run.

  • Possible other thread creation and module load events.

  • An entry point event, which signals that the program has reached its main entry point, such as Main or WinMain. This event isn't typically sent if the DE attaches to a program that is already running.

    Programmatically, the DE first sends the session debug manager (SDM) an IDebugEngineCreateEvent2 interface, which represents an engine creation event, followed by an IDebugProgramCreateEvent2, which represents a program creation event.

    These events are typically followed by one or more IDebugThreadCreateEvent2 thread creation events and IDebugModuleLoadEvent2 module load events.

    When the code is loaded and ready to run, but before any code is executed, the DE sends the SDM an IDebugLoadCompleteEvent2 load complete event. Finally, if the program isn't already running, the DE sends an IDebugEntryPointEvent2 entry point event, signaling that the program has reached its main entry point and is ready for debugging.

See also