Launch-based attachment

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

Launch-based attachment to a program is automatic. When the process hosting the program is launched by the SDM, launch-based attachment follows a path similar to that of the manual attachment method. For information, see Attach to the program.

The attaching process

The main difference is the sequence of events following the Attach call, as follows:

  1. Send an IDebugEngineCreateEvent2 event object to the SDM. For details, see Send events.

  2. Call the IDebugProgram2::GetProgramId method on the IDebugProgram2 interface passed to the Attach method.

  3. Send an IDebugProgramCreateEvent2 event object to notify the SDM that the local IDebugProgram2 object was created to represent the program to the DE.

  4. Send an IDebugThreadCreateEvent2 event object to notify the SDM that a new thread is created for the process that launched.

See also