VMware Communities
gerryg404
Contributor
Contributor

Trouble connecting gdb to VMWare Fusion

Hi,

I'm trying to debug an OS running on VMWare Fusion but I there is something wrong. I get the "register badly formatted" error.

(gdb) file ~/anvilos/src/os/kernel/build-x86_64/anvil-knl

Load new symbol table from "/Users/gerryg/anvilos/src/os/kernel/build-x86_64/anvil-knl"? (y or n) y

Reading symbols from /Users/gerryg/anvilos/src/os/kernel/build-x86_64/anvil-knl...done.

(gdb) show arch

The target architecture is set automatically (currently i386:x86-64)

(gdb) target remote localhost:8864

Remote debugging using localhost:8864

Sending packet: $qSupported:multiprocess+;xmlRegisters=i386;qRelocInsn+#b5...Ack

Packet received:

Packet qSupported (supported-packets) is NOT supported

Sending packet: $Hg0#df...Ack

Packet received: OK

Sending packet: $?#3f...Ack

Packet received: T05thread:00000001;06:e04b00d0ffffffff;07:e80f01f0ffffffff;10:716300c0ffffffff;

Sending packet: $Hc-1#09...Ack

Packet received: E00

Sending packet: $qAttached#8f...Ack

Packet received:

Packet qAttached (query-attached) is NOT supported

Sending packet: $qOffsets#4b...Ack

Packet received:

Remote register badly formatted: T05thread:00000001;06:e04b00d0ffffffff;07:e80f01f0ffffffff;10:716300c0ffffffff;

here: ffffffff;07:e80f01f0ffffffff;10:716300c0ffffffff;

Does anyone have a suggestion about what may be wrong

thanks

Gerry

0 Kudos
2 Replies
dariusd
VMware Employee
VMware Employee

Hi Gerry, and welcome to the VMware Communities!

Which version of gdb are you running?

If it's an Apple build of gdb, try launching gdb with -arch x86_64 as a command-line argument.

Either way, try an explicit set arch i386:x86-64 ... for some versions of gdb, that seems to be necessary to really kick it into 64-bit mode, even if show arch reports that it is already set to i386:x86-64.

Cheers,

--

Darius

0 Kudos
gerryg404
Contributor
Contributor

Thanks Darius,

I tried several versions including lldb, the gdb with macports and a *-elf gdb I built myself with no luck.

I then built a *-linux-elf gdb and it works !! It seems that the packet layout is slightly different or something. What's more I have been able to fix the deadlock I had in my kernel which was the real point of the exercise.

thanks very much for taking the time to reply.

regards

Gerry

0 Kudos