Subject: RE: Debugging a device driver (How to?)
To: Riaz Randeree <tech-kern@netbsd.org>
From: Martin Husemann <martin@rumolt.teuto.de>
List: tech-kern
Date: 04/16/1999 10:34:04
> I build the kernel and netbsd & netbsd.dbg are created

Serial gdb to debug a kernel works fine, but maybe not too well documented -
should this be in the FAQ?

So, what works for me (using it nearly every day):

 - "boot netbsd -d" (not the netbsd.gdb kernel with megabytes of local
symbols in it)
 - wait for "kgdb waiting..." prompt
 - start gdb in kernel compile directory on other machine

On the other machine I have this line in /etc/ttys:

--8<--
tty00 "/usr/libexec/getty default"      vt100 off local
-->8--

The "local" is important!

In the kernel compile directory I have a .gdbinit file with this contents:
--8<--
file netbsd.gdb
set remotebreak 1
set remotebaud 38400
target remote /dev/tty00
-->8--

Of course make sure the baudrates matches the one in the KGDBRATE option,
and the serial line is plugged into the right connectors ;-) I once needed
four boots to notice I had switched my serial mouse and the debugger serial
line :-(


Martin