Debug with VMware and gdb

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
Bonfra
Member
Member
Posts: 270
Joined: Wed Feb 19, 2020 1:08 pm
Libera.chat IRC: Bonfra
Location: Italy

Debug with VMware and gdb

Post 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)
Regards, Bonfra.
Octocontrabass
Member
Member
Posts: 5560
Joined: Mon Mar 25, 2013 7:01 pm

Re: Debug with VMware and gdb

Post by Octocontrabass »

If you set debugOnStartGuest32 to true, you need to attach a 32-bit debugger to port 8832. There is no debugOnStartGuest64.
User avatar
Bonfra
Member
Member
Posts: 270
Joined: Wed Feb 19, 2020 1:08 pm
Libera.chat IRC: Bonfra
Location: Italy

Re: Debug with VMware and gdb

Post 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.
Regards, Bonfra.
norey
Posts: 1
Joined: Thu Oct 10, 2024 11:44 am

Re: Debug with VMware and gdb

Post by norey »

@Bonfra, were you able to successfully connect via gdb?

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