Attaching to Running Processes
This topic applies to:
Pro and Team
Does not apply
Command or commands hidden by default.
The Visual Studio debugger has the ability to attach to a process that is running outside of Visual Studio. You can use this attach capability to do the following:
Debug an application that was not created in Visual Studio.
Debug multiple processes simultaneously. You can also debug multiple processes by starting multiple projects within a single solution.
Debug a process running on a remote computer.
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 process crashes while running outside of Visual Studio. This is Just-In-Time debugging.
After 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 Viewing Data in the Debugger. 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.
For the debugger to attach to code written in C++, the code needs to emit DebuggableAttribute. You can add this to your code automatically by linking with the /ASSEMBLYDEBUG linker option.