Remote debugging is an important feature in Visual Studio that allows us to debug on the target machine. Because of different computers, the operating environment is not the same, so the compiled program may not be able to run on the target machine, but there is no source code on the target, so we can use remote debugging at this time. such as debugging a setup program in a virtual machine.
1. Copy the remote debugging tool to the target machine.
Remote debugging requires the use of remote debugging tools from the Visual Stuido Debugger. The tool is in the installation directory of visual Stuido, such as my installation directory in D-disk, D:\Program Files (x86) \microsoft Visual Studio 12.0\common7\ide\remote Debugger\ X86, select the specific machine type and test the folder on the target machine.
2. Run the Remote debugging tool
Open the copied directory file and run Msvmon.exe as administrator. Such as:
Select the "Tools" menu, "Options" in the drop-down menu, configured as follows:
After the configuration is complete, click "OK", at this time, you can run the program on the target machine, the program should have an error. The next step is to configure the environment for Visual Studio on the debug machine.
3. Use visual Stuido to attach the running process on the target machine.
Open visual Studio with the source code for the error program and attach the program on the target machine to the process as follows:
Select the mode of transmission for remote (no authentication), the qualifier entered the target machine (remote machine) IP address, after the refresh, if the connection is error-free, you can see the target machine running errors in the application process, select the process, at this time, the Visual The code in studio is attached to the remote process, at which point Visual Studio enters the debug state.
4. Debug remote error process mode.
when Visual Studio enters the debug state, it uses "break all" to locate an error in the target machine, or it can be interrupted by a popup modal dialog box.
5. Summary
Remote debugging can be useful in some cases to help us find the hidden issues associated with the environment configuration in our programs, making our programs more robust.
Visual Studio Remote Debugging