VMware Communities
xtanjx
Contributor
Contributor

Using debugStub to debug a guest linux kernel

I am running VMware Fusion Version 6.0.2 (1398658)

I have configured the following in my vmx

debugStub.listen.guest64 = "TRUE"

debugStub.listen.guest64.remote = "TRUE"

debugStub.hideBreakpoints=1

I had a problem with using the (xcode) provided gdb, which I resolved by using gdb on a second vm.

I now connect using the commands

(gdb) file /pathto/mykernel.symbols

(gdb) target remote osx-host:8864

This is all working fine.

Here's my question, I would like to be able to attach to more than one debug vm kernel session at a time. Is there a .vmx config that will allow me to specify which port to listen on?  That way I can attach to 8864 for one vm and say 8865 on another.

Tags (1)
Reply
0 Kudos
4 Replies
admin
Immortal
Immortal

If port 8864 is in use, it should automatically move on to 8865 for the next connection...for up to 31 ports.

dariusd
VMware Employee
VMware Employee

In addition to what jmattson said, if you want to statically allocate ports to specific VMs:

   debugStub.port.guest64 = "8865"

should do what you need, although I tend to use a port range a bit distant from the usual 8864 when doing this, just to make sure it doesn't collide with lingering socket endpoints and such.

Cheers,

--

Darius

xtanjx
Contributor
Contributor

First, thank you both for your help.

Summarized below are the debugStub settings as I understand them.

debugStub.listen.guest64 = "TRUE"                          # Enable listener for 64 bit guest

debugStub.listen.guest64.remote = "TRUE"              # Allow remote connection

debugStub.port.guest64 = "42040"                          # Listen on specified port NNN, e.g., 42040

debugStub.listen.guest32 = "TRUE"                          # Enable listener for 32 bit guest

debugStub.listen.guest32.remote = "TRUE"              # Allow remote connection

debugStub.port.guest32 = "32001"                          # Listen on specified port NNN

debugStub.hideBreakpoints= "TRUE"                        # Set hardware breakpoints -- limited by HW

These settings allow me to connect to a VMware fusion VM with a gdb command like:

(gdb) target remote osx-host:42040                        # connects to the listener on 42040

Now, when I do that I see exactly one thread per guest CPU. Is that expected?  I was hoping to see all the light weight kernel threads being run by the Guest OS.

Reply
0 Kudos
admin
Immortal
Immortal

xtanjx wrote:

Now, when I do that I see exactly one thread per guest CPU. Is that expected?  I was hoping to see all the light weight kernel threads being run by the Guest OS.

That is correct.  DebugStub knows nothing at all about the guest OS.  Think of debugStub as an In-Circuit Debugger for the virtual CPU(s).

Reply
0 Kudos