Virtualbox + windbg for dual-machine debugging

Source: Internet
Author: User

I used to see that they used VMware to debug drivers and other such software. I didn't use this software. I felt that the software was a bit bloated, and the background services were suspended too much, so I didn't do it.
In addition, the virtual box with Oracle installed on the computer has long been read. In fact, virtual box also supports Serial Port devices. In theory, it can also be connected using windbg. I always think that virtual box is quite useful.
Since I wrote this blog, it proves that I have successfully debugged it.
Next, let's take the following steps (ignore the steps that have been completed ):
(If the image display is incomplete, right-click the image to view it)

1. Install virtual box Virtual Machine
Official Website: https://www.virtualbox.org/
Find the downloads tag on the left and select the appropriate installation package for your platform (much smaller than VMware ).
This software comes with a Chinese Language Pack and is open-source + free software, so do not go to other places to find any cracking, green, and so on. If it is not good, it is a combination of XX.

2. Install the virtual machine operating system
There are too many virtual machine operating systems installed in vbox.
The operating system I installed is xp_sp3, a newbie, or something "low-level.

3. Additional settings for the operating system in the Virtual Machine
General settings, such as memory size and memory size, should be allocated as appropriate.
3.1 support settings for serial ports (must be set when shutdown)

Pay attention to the pipe naming rules. Otherwise, the creation will fail.

3.2 share files between virtual machines and real machines
Method 1 (directory sharing ):



Method 2 (simple and convenient, but it seems to cause drag and drop problems on the computer ):

3.3 modify the operating system configuration file to start debugging mode
In the VM, find c: \ windows \ Boot. ini (hidden, read-only) and add the following line at the end:
Multi (0) disk (0) RDISK (0) Partition (1) \ Windows = "Microsoft Windows XP Professional"/noexecute = optin/fastdetect/debug/debugport = COM1/baudrate = 115200
/Debugport = COM1 is the part after the name of the created MPs queue :\\. \ PIPE \ COM1,/baudrate = 115200 indicates setting the baud rate (this can be larger, faster, but not randomly set)
/Debug indicates that debugging is enabled.
After modification, it is probably like this:
[Boot loader]
Timeout = 5
Default = multi (0) disk (0) RDISK (0) Partition (1) \ WINDOWS
[Operating systems]
Multi (0) disk (0) RDISK (0) Partition (1) \ Windows = "Microsoft Windows XP Professional"/noexecute = optin/fastdetect
Multi (0) disk (0) RDISK (0) Partition (1) \ Windows = "Microsoft Windows XP Professional"/noexecute = optin/fastdetect/debug/debugport = COM1/baudrate = 115200

Restart the VM and select the 2nd boot menu to enter the debugging mode:

4. Configure windbg for debugging
4.1 download the symbolic file (if not)
1) Go to http://msdn.microsoft.com search download
2) To http://msdn.microsoft.com/en-us/windows/hardware/gg463028.aspx
I downloaded Windows XP with Service Pack 3x86 checked symbols, all versions ages (file size: 202 MB)
Download it as needed.
4.2 create a batch of processing script files (dual-machine debugging. BAT)
The content is as follows:

@ Echo off: Debug windbg path (double quotation marks with spaces) set windbg = "I: \ Dynamic debug \ windbg v6.11.0001.404 x86 \ windbg_en.exe": set command line parameters :: COM: Port = \\. \ PIPE \ COM1 is the pipeline created above. the baud rate must be consistent:-y h: \ cache \ symbols indicates the path of the debug symbol file set Param =-B-K COM: Port = \\. \ PIPE \ COM1, baud = 115200, pipe-y h: \ cache \ symbols: Enable debugging start "" % windbg % Param % Goto: EOF

Figure:

After saving, double-click to open the bat script file to open windbg and debug the Virtual Machine (first open the Virtual Machine and enter the debugging mode)

At the beginning, the virtual machine may process the unresponded status (debugged). Follow the instructions above and execute command g in the following command line to continue.
Then, load the corresponding driver/program by sharing the file and start debugging by manually dropping the breakpoint:
Manually add a breakpoint to the driver:
# If dbg
_ Asm int 3
# Endif

The virtual machine can be suspended to the debugging status.

Girl don't cry (QQ: 191035066) @ 10:34:47 http://www.cnblogs.com/nbsofer

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.