Due to my limited ability, translation deficiencies please understand, welcome criticism: [Email protected]
Visual Studio version: Visual Studio 2015 Enterprise Edition, Chinese environment.
MSDN Original: https://msdn.microsoft.com/zh-cn/library/windows/hardware/hh406273 (v=vs.85). aspx
In Visual Studio, you can attach a running process or product to a new process by using the Windows User mode debugger (Windows user modes Debugger). A process can run on the same computer that is running the debugger, or it can run on a different computer.
Attach a running process on the same computer
- In Visual Studio 2015, from the Debug menu, select Attach to process, and other versions of Visual Studio from the Tools menu, select Attach to process.
- In the Attach to Process dialog box, set transfer toWindows User Mode Debugger, and then set qualifier to "Localhost".
- In the Available Processes list, select the process that you want to attach.
- Click on the "Attach" button.
Non-intrusive commissioning
If you are like debugging a running process and want to limit the impact on it to a minimum, you should debug this process noninvasively non-intrusive.
Create a new process on the same computer
- In Visual Studio, from the Tools menu, selectLaunch under Debugger.
- In theLaunch under Debuggerdialog box, in the path to the executable file text box, enter the information you want to attach the program paths, you can enter the parameters in the "Arguments" text box, in the " Enter the working directory in the Working Directory text box.
- Click on the "Launch" button.
The process that the debugger creates (also known as spawned processes) and the processes that are not created by the debugger behave somewhat differently.
Instead of using the standard heap API, the debugger creates a process that uses a special debug heap. You can force a (spawned processes) to replace the debug heap with a standard heap, implemented by using _NO_DEBUG_HEAP environment variables.
In addition, because the target program is a child of the debugger, it inherits the permissions of the debugger, which may allow the target program to perform certain behaviors that are not allowed at other times, such as: The target program may affect the protection process.
Attach a running process from a separate computer
Sometimes the debugger and the code to be debugged run on different computers. The computer running the debugger is called the hostcomputer, and the computer running the debug code is called the targetcomputer. You can configure the target machine from Visual Studio on the host. Configuration target machine is also called (provisioning) Target machine, more information, view: Provision a computer for driver deployment and testing (WDK 8.1).
After configuring the target machine, you can attach a process in the host's Visual Studio that is running in the target machine.
- In Visual Studio 2015, from the Debug menu, select Attach to process, and other versions of Visual Studio from the Tools menu, select Attach to process.
- In the Attach to Process dialog box, set transfer toWindows User Mode Debugger, and then set the qualifier as the target machine.
- In the Available Processes list, select the process that you want to attach.
- Click on the "Attach" button.
Note: If you are using a different PC as the host and target, do not install Visual Studio and WDK in the target machine, and if Visual Studio and WDK are installed on the target machine, debugging is supported.
Debugging user-mode processes using Visual Studio (debugging a User-mode process using Visual Studio)