Поделиться через


Attaching to Running Processes

This topic applies to:

Edition

Visual Basic

C#

F#

C++

Web Developer

Express

Topic does not apply Topic does not apply Topic does not apply Topic does not apply Topic does not apply

Pro, Premium, and Ultimate

Topic applies Topic applies Topic applies

Topic applies

Topic applies

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.

Note

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.

In This Section

How to: Attach to a Running Process

How to: Refresh the Available Processes List

How to: Set the Current Process

How to: Select a Remote Machine

How to: Deal with Attach Errors

How to: Detach All Processes

How to: Attach to Script

Debugger Roadmap