Part 1 (STEP ):
First, the unified name is used. The real operating system is Hostos, and the virtual operating system is guestos in VMware.
1. Install guestos in VMware. Download and install windbg.
2. Add a serial port
Hardware can be added only when guestos is disabled. The procedure for adding a serial port is as follows:
Select "Serial Port ",
Select "output named Pipeline ",
Other settings are as follows:
3. Enter the following content in the boot. ini file of guestos:
Multi (0) disk (0) RDISK (0) Partition (1)/Windows = "Microsoft
Windows XP Professional debug "/fastdetect/debugport = COM1
/Baudrate = 115200
4. Create a windbg shortcut and add the following content to the "target" column:
-B-K
COM: pipe, Port = //./pipe/com_1, resets = 0
5. Restart guestos and select debug mode.
6. Double-click the shortcut created in step 1 to start windbg. It will automatically connect to and debug guestos.
We can see that the kernel has been successfully debugged. Now we can debug the kernel as much as possible.
Part 2 (explanation ):
The principle is that VMware virtualizes A comport on guestos and creates an MPS queue on Hostos. one end of the MPs queue is connected to the comport of guestos, and the other end is windbg. Therefore, Hostos (windbg) all data exchanges with guestos are forwarded through this pipeline.
1. My computer does not have a comport, so I cannot build a debugging environment?
No. Does your computer have a comport that has nothing to do with the debugging environment? The whole process is not using the physical comport of your computer. VMware only virtualized A comport in guestos.
2. When creating a serial port (A comport belongs to a serial port), I can see that the specified pipe is "//./pipe/com_1". Can I specify it as another one?
Yes. This is just to specify the name of a pipe. VMware uses this name to create a named pipe. I can change it to "//. /pipe/Liangyu "," //. /pipe/AAA ", but remember to change the pipe name at the windbg shortcut to the same.
3. Can I change the comport in the boot. ini file of guestos? For example, changing COM1 to com2?
No. VMWare always defines the virtual comport as com1. Other comports of guestos have to give way.
4. Check "I/O mode" in many tutorials ",
Are you sure you want to select?
If this option is not selected, I have not found any major difference.
5. When changing the boot. ini file of guestos, add "/debugport = COM1
/Baudrate = 115200 ". What does it mean?
The debug port is COM1 and the baud rate is 115200. This is to tell guestos to debug the kernel (operating system) and output the debugging information to the COM1 port. The baud rate is 115200.
During the experiment, I found that the baud rate is not necessarily set to 115200, but can be changed to 112233, 445566, or other data. It may be because windbg automatically adjusts the baud rate to adapt to the pipe or comport, so the baud rate is meaningless here.
6. added "-B-k" to the windbg shortcut
COM: pipe, Port = //./pipe/com_1, resets = 0 ", meaning?
It generally means that the pipeline "//./pipe/com_1" is used for kernel debugging. Parameters are described in the windbg reference document. paste the following content here:
-B
(Kernel mode only)
This option has two effects:
1. the debugger will break into the target computer immediately
Connection.
2. After a reboot, the debugger will break into the target computer once
Kernel is initialized. See crashing
And rebooting the target computer
For details and for other methods
Changing this status.
-K
[
Connecttype
]
(Kernel mode only)
Starts a kernel debugging session. For details,
See choosing
Kernel debugging settings
. If
-K
Is used without any
Connecttype
Options following it, it must be the final entry on
Command line.
Resets = 0
Specifies that an unlimited number of reset packets can be sent to
Target when the host and target are synchronizing. Use
Resets = 0
Parameter for Microsoft Virtual PC and other virtual
Machines whose pipes Drop excess bytes. Do not use this parameter for VMware or
Other virtual machines whose pipes do not drop all excess bytes.
7. Do you have to create a windbg shortcut for debugging?
No, we can run windbg normally first, then select "file" ---> "kernel debug..." from the menu, and then the following dialog box will pop up:
Set the settings as above and click OK. This can also be debugged.
8. Are there any sequence in steps 5th and 6th above? Many documents emphasize this order.
This is not sequential. You can execute step 5th first, or step 6th first, and then step 6th.
After the debug mode is selected, even if you have been in the system for a long time and run many things, you can still connect to debug as long as you run windbg. So there is no sequence here.