Subject: RE: Debugging a device driver (How to?)
To: Riaz Randeree <>
From: Martin Husemann <>
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:

tty00 "/usr/libexec/getty default"      vt100 off local

The "local" is important!

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

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 :-(