Skip to contentSkip to conversation

GDB stub for stubdom

DISCUSSION Ferenc Wagner 4 participants 6 messages Apr 30, 2009

lore
Share & tools
lore
#0 lore raw

Hi,

Did anybody consider adding some remote debugging facility to stubdom? Or maybe it's already present? If not, putting in a GDB remote stub shouldn't be too hard, though I don't know much about the low level architecture. Such code is present in gPXE, for example.

Usage docs: http://www.etherboot.org/wiki/dev/gdbstub
Main code: http://git.etherboot.org/?p=gpxe.git;a=blob;f=src/core/gdbstub.c

The transport could be some Xen specific channel between the stubdom and dom0 (that would be out of band and hopefully also easy to implement) translated to/from TCP by a proxy on dom0.

(The official GDB example seems uglier:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/i386-stub.c?cvsroot=src)

Signature · 2 lines
Regards,
Feri.
#1 lore raw
Quoted 6 lines · Ferenc Wagner

Hi,

Did anybody consider adding some remote debugging facility to stubdom? Or maybe it's already present? If not, putting in a GDB remote stub shouldn't be too hard, though I don't know much about the low level architecture. Such code is present in gPXE, for example.

I think gdbserver-xen should be able to debug a stub dom just like any other.

Ian.

#2 lore raw
Quoted 9 lines · Ian Campbell
Quoted 4 lines · Ferenc Wagner

Did anybody consider adding some remote debugging facility to stubdom? Or maybe it's already present? If not, putting in a GDB remote stub shouldn't be too hard, though I don't know much about the low level architecture. Such code is present in gPXE, for example.

I think gdbserver-xen should be able to debug a stub dom just like any other.

Thanks, I haven't yet heard about it. I'd try it if it compiled, but apparently I'm missing something (Xen-3.3.1, still :):

In file included from ../../../gdb-6.2.1/gdb/gdbserver/linux-xen-low.c:38:
../../../../../libxc/xenctrl.h:36:32: error: xen/foreign/x86_32.h: No such file or directory ../../../../../libxc/xenctrl.h:37:32: error: xen/foreign/x86_64.h: No such file or directory
In file included from ../../../gdb-6.2.1/gdb/gdbserver/linux-xen-low.c:38:
../../../../../libxc/xenctrl.h:175: error: expected specifier-qualifier-list before ‘vcpu_guest_context_x86_64_t’ ../../../../../libxc/xenctrl.h:184: error: expected specifier-qualifier-list before ‘shared_info_x86_64_t’ ../../../../../libxc/xenctrl.h:193: error: expected specifier-qualifier-list before ‘start_info_x86_64_t’ ../../../../../libxc/xenctrl.h:966: error: expected declaration specifiers or ‘...’ before ‘hvmmem_type_t’

That foreign directory is definitely not there...

Signature · 1 line
Feri.
#3 lore raw

Am Donnerstag, den 30.04.2009, 15:01 +0200 schrieb Ferenc Wagner:

Quoted 24 lines
Quoted 9 lines · Ian Campbell
Quoted 4 lines · Ferenc Wagner

Did anybody consider adding some remote debugging facility to stubdom? Or maybe it's already present? If not, putting in a GDB remote stub shouldn't be too hard, though I don't know much about the low level architecture. Such code is present in gPXE, for example.

I think gdbserver-xen should be able to debug a stub dom just like any other.

Thanks, I haven't yet heard about it. I'd try it if it compiled, but apparently I'm missing something (Xen-3.3.1, still :):

In file included from ../../../gdb-6.2.1/gdb/gdbserver/linux-xen-low.c:38:
../../../../../libxc/xenctrl.h:36:32: error: xen/foreign/x86_32.h: No such file or directory ../../../../../libxc/xenctrl.h:37:32: error: xen/foreign/x86_64.h: No such file or directory
In file included from ../../../gdb-6.2.1/gdb/gdbserver/linux-xen-low.c:38:
../../../../../libxc/xenctrl.h:175: error: expected specifier-qualifier-list before ‘vcpu_guest_context_x86_64_t’ ../../../../../libxc/xenctrl.h:184: error: expected specifier-qualifier-list before ‘shared_info_x86_64_t’ ../../../../../libxc/xenctrl.h:193: error: expected specifier-qualifier-list before ‘start_info_x86_64_t’ ../../../../../libxc/xenctrl.h:966: error: expected declaration specifiers or ‘...’ before ‘hvmmem_type_t’

Quoted 1 line

That foreign directory is definitely not there...

You have to build the rest of the tree first. There should be a README file... Builds fine here.

Marc

#5 lore raw
In reply to Ian Campbell
Quoted 8 lines · Ian Campbell, le Thu 30 Apr 2009 13:12:32 +0100, a écrit :
Quoted 4 lines · Ferenc Wagner

Did anybody consider adding some remote debugging facility to stubdom? Or maybe it's already present? If not, putting in a GDB remote stub shouldn't be too hard, though I don't know much about the low level architecture. Such code is present in gPXE, for example.

I think gdbserver-xen should be able to debug a stub dom just like any other.

Yes (apart from its limitations, like 32/64 bit incompatibilities)

Samuel

#4 lore raw
In reply to Marc - A. Dahlhaus [ Administration | Westermann GmbH ]

"Marc - A. Dahlhaus [ Administration | Westermann GmbH ]" <[email protected]>

Quoted 6 lines · writes:

Am Donnerstag, den 30.04.2009, 15:01 +0200 schrieb Ferenc Wagner:

Quoted 1 line

That foreign directory is definitely not there...

You have to build the rest of the tree first. There should be a README file... Builds fine here.

Yes, indeed the README mentions that. Too bad it required Python.h, but didn't check for its presence (not even the development version).

Anyway, after fixing this the directory symlink appears, but still:

gcc -c -Wall -g -O2 -I. -I../../../gdb-6.2.1/gdb/gdbserver -I../../../gdb-6.2.1/gdb/gdbserver/../regformats -I../../../gdb-6.2.1/gdb/gdbserver/../../include -I../../../../../libxc/ -I../../bfd -I../../../gdb-6.2.1/gdb/gdbserver/../../bfd ../../../gdb-6.2.1/gdb/gdbserver/linux-i386-low.c
In file included from ../../../gdb-6.2.1/gdb/gdbserver/linux-xen-low.c:38:
../../../../../libxc/xenctrl.h:36:32: error: xen/foreign/x86_32.h: No such file or directory ../../../../../libxc/xenctrl.h:37:32: error: xen/foreign/x86_64.h: No such file or directory [...]
make[3]: Leaving directory `/home/wferi/xen/xen-3.3.1/tools/debugger/gdb/gdb-6.2.1-linux-i386-xen/gdb/gdbserver'

That is, tools/include/xen/foreign is not amongst the include paths.

I'm persuaded to try the unstable tree, where this works all right. You (or at least Samuel) won! :)

Signature · 2 lines
Cheers,
Feri.