Page 1 of 1

Debug with VMware and gdb

Posted: Mon Feb 22, 2021 2:58 am
by Bonfra
I've always tested my code using QEMU and it works perfectly but trying to boot the image with Virtualbox or VMware always causes some problems with the bootloader. I wanted to debug the code using gdb but I can't figure out how to connect to the VM.
I followed this and some other guides all saying the same things.
Whenever I boot up the machine VMware hangs forever (finally I need to kill it with the task manager) and gdb prints this error:

Code: Select all

(gdb) target remote localhost:8864
Remote debugging using localhost:8864
Ignoring packet error, continuing...
warning: unrecognized item "timeout" in "qSupported" response
Ignoring packet error, continuing...
Remote replied unexpectedly to 'vMustReplyEmpty': timeout
(gdb)

Re: Debug with VMware and gdb

Posted: Mon Feb 22, 2021 5:09 pm
by Octocontrabass
If you set debugOnStartGuest32 to true, you need to attach a 32-bit debugger to port 8832. There is no debugOnStartGuest64.

Re: Debug with VMware and gdb

Posted: Mon Feb 22, 2021 5:16 pm
by Bonfra
Octocontrabass wrote:There is no debugOnStartGuest64.
Guide wrote:Note that there is also 64-bit support, just replace 32 with 64 in the above options
Infact dumping the log file I found this lines:

Code: Select all

VMware Workstation is listening for debug connection on port 8864.
    (gdb) target remote localhost:8864
    (lldb) gdb-remote 8864
The guide says that if I set the vmx file "debugStub.listen.guest64" to "true" I can use port 8864 to debug.
Also since debugOnStartGuest64 breaks on the first instruction of the BIOS, I didn't enable it. I just run gdb a second before starting the VM so it catches up kinda immediately on the breakpoint I specified before.

Re: Debug with VMware and gdb

Posted: Thu Oct 10, 2024 11:51 am
by norey
@Bonfra, were you able to successfully connect via gdb?

I'm facing the same issue. gdb 15.1 and Workstation 17.6