Use vmware workstation+gdb to debug the startup process of the virtual machine

1. Modify the vmx configuration file (change all 64 to 32 in the following contents of the 32-bit kernel program)

Add the following content at the end of the vmx file of the virtual machine:


debugStub.listen.guest64 = “TRUE”
debugStub.hideBreakpoints = “TRUE”
debugStub.listen.guest64.remote = “TRUE”
monitor.debugOnStartGuest64 = “TRUE”

debugStub.listen.guest64 = "TRUE": This parameter enables 64-bit guest debugging of the virtual machine, allowing debugging in 64-bit guest operating systems.

debugStub.hideBreakpoints = "TRUE": This parameter hides breakpoint information during debugging, making the debugging process more secretive. This can be used in some cases to prevent malicious users from exploiting the debugging capabilities to compromise the security of the virtual machine.

debugStub.listen.guest64.remote = "TRUE": This parameter instructs the virtual machine to enable the remote debugging function, allowing the use of a remote debugger to connect to the virtual machine and perform debugging operations.

monitor.debugOnStartGuest64 = “TRUE”: This parameter instructs the virtual machine to automatically start 64-bit guest debugging when it starts. This way, the virtual machine will wait for the debugger to connect when the guest operating system starts up, allowing debugging operations to take place.

2. Gdb connection
Enter the command in gdb:
If vmware is on the physical machine, and use the cmd of win to execute dgb, start dgb directly, use the command:

target remote localhost:8864

If you check the physical machine ip first in wsl
:

ip route | grep default | awk '{print $3}'

link again

target remote ip:8864

Guess you like

Origin blog.csdn.net/weixin_52111404/article/details/131509203