remote gdb stub

Derick Swanepoel dswanepoel at
Fri Jul 29 12:17:48 CEST 2005

On 7/27/05, Bert van Leeuwen <bert.vanleeuwen at> wrote:
> I've found this example:
> oskit10/examples/x86/shared/intr_console.c
> will let you know how it pans out, looks simple enough barring any caveats.
> On 7/27/05, Bert van Leeuwen <bert.vanleeuwen at> wrote:
> > Is there a tutorial or guide somewhere about how to use remote gdb
> > (from a linux machine) to debug an L4 task? I haven't been able to
> > find much more info about this other than casual mention that it is
> > supported...

I have also been trying to remotely debug an L4 task with GDB over a
second serial line, with inspiration from the above example. Using
gdb_pc_com_init() to initialise the serial port for GDB works, but
when a pagefault occurs JDB is invoked and not GDB. Looking at
intr_console.c I saw that it also sets up debug registers to catch
null pointer dereferences using the following code:

set_b0(NULL, DR7_LEN_1, DR7_RW_INST);
set_b1(NULL, DR7_LEN_4, DR7_RW_DATA);

I then included this in my program, but now it hangs in the set_b0()
call. (The OSKit documentation doesn't mention having to set up debug
registers when using remote GDB debugging, so I'm not sure whether
this is correct.) However, at that point I can connect with GDB and
perform all the neat GDB functions like inspecting variable values,
etc. Unfortunately, when stepping to the next instruction I get the
following pagefault:

test    | Dump of trap_state at 0x042ff834:
test    | EAX 042ffacc EBX 042ff948 ECX 00000001 EDX 01600000
test    | ESI 00000000 EDI 042ff93c EBP 042ffaf4 ESP 01730db1
test    | EIP 0173287c EFLAGS 00013102
test    | CS 001b SS f93c DS 0023 ES 0023 FS 0023 GS 0023
test    | trapno 13, error 00000000, from user mode
test    | terminated due to trap
test    |
test    | PANIC. Backtrace: fp=42ff7c8
test    |  01704869 01731ebb 01731f1f 0172fe1f 01730ffb 0173140a 0172fe41
test    |  01730ffb 0173140a 0172fe41 01600f63 01705561 0170d2b1L4RM:
[PF] read at 0x04300000, eip 01705402, src F.02
test    | [F.0] l4rm/lib/src/pagefault.c:78:__unknown_pf():
test    |  unhandled page fault

Can anyone shed some light on how remote GDB debugging should be done
under L4? Any help would be greatly appreciated.


More information about the l4-hackers mailing list