Export (0) Print
Expand All

Attaching to a Running Program or Multiple Programs

The Visual Studio debugger has the ability to attach to a program that is running in a process outside of Visual Studio. You can use this attach capability to:

  • Debug a program that was not created in Visual Studio.
  • Debug multiple programs simultaneously. (You can also debug multiple programs by starting multiple projects within a single workspace. For details, see Debugging Multiple Programs.)
  • Debug a program running on a remote machine.
  • Debug a DLL that runs in a separate process that cannot easily be started from Visual Studio (for example, a service or an ISAPI DLL running with Internet Information Services).
  • Start the debugger automatically when a program crashes while running outside of Visual Studio (Just-In-Time debugging).

The topics in this section provide instructions for:

Once you have attached to a program, you can use debugger execution commands, inspect the program state, and so on. For more information, see Execution Control and Debugging Tools for Inspecting Your Program. Your ability to inspect the program may be limited, of course, depending on whether the program was built with debug information and whether you have access to the program's source code, and whether the common language runtime JIT compiler is tracking debug information.

Note   For the debugger to attach to code written in Managed Extensions for C++, the code needs to emit DebuggableAttribute. You can add this to your code automatically by linking with the /ASSEMBLYDEBUG linker option.

See Also

Using the Debugger

Show:
© 2014 Microsoft