Subject: Re: remote GDB of kernel
To: Laine Stump <>
From: Greg Oster <>
List: current-users
Date: 12/06/1999 07:46:26
Laine Stump writes:
> Any other ideas? Has anyone run gdb on a kernel lately?

Yes, and yes :)

On the machine I'm debugging, I boot with "boot -d".  It'll sit and wait
for gdb on the other machine to talk to it before continuing.  On the 
machine I'm running gdb on, I do the following:

  1) 'gdb netbsd.gdb' (I do this from the kernel build directory, although 
that's probably not strictly necessary).
  2) From within gdb now:
      set remotebreak 1
      target remote /dev/tty01 
      (I've got the null modem connection on tty01 on this box).
If things go right, you'll see something like:
(gdb) set remotebreak 1
(gdb) target remote /dev/tty01
Remote debugging using /dev/tty01
kgdb_connect (verbose=1) at ../../../../arch/i386/i386/kgdb_machdep.c:244
244             if (verbose)

At that point you can set your breakpoints, look at stuff/do whatever, and 
whenever you're ready to actually boot the thing, hit 'c'(and <RETURN>) 
to continue.  You can also hit CTRL-c within gdb at any time, and the remote
kernel will stop and wait for you to debug it :)

My /etc/ttys for tty01 looks like:
tty01   "/usr/libexec/getty std.9600"   unknown off secure local 

(I seem to recal that the 'local' part was important)

Hmm.. I'm not sure if I'm missing anything else or not, but if the above 
doesn't get you going, I can look more closely at my current configuration...
(I successfully ran kgdb a few days ago on a -current kernel)

Hope this helps..


Greg Oster