Debugging user-mode processes using Visual Studio (debugging a User-mode process using Visual Studio)

Source: Internet
Author: User

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

    1. 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.
    2. In the Attach to Process dialog box, set transfer toWindows User Mode Debugger, and then set qualifier to "Localhost".
    3. In the Available Processes list, select the process that you want to attach.
    4. 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

    1. In Visual Studio, from the Tools menu, selectLaunch under Debugger.
    2. 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.
    3. 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.

    1. 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.
    2. In the Attach to Process dialog box, set transfer toWindows User Mode Debugger, and then set the qualifier as the target machine.
    3. In the Available Processes list, select the process that you want to attach.
    4. 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)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.