Subject: Re: Debugging a device driver (How to?)
To: Riaz Randeree <>
From: Greg Oster <>
List: tech-kern
Date: 04/15/1999 09:27:51
Riaz Randeree writes:
> Hello
> I have tried serial debugging:
> On the target machine:
>         options         DEBUG="-g"
>         options         KGDB
>         options         KGDBRATE=9600
>         options         KGDBADDR=0x3f8             # yes I
> am using the 1st serial port
>        #options        DDB                         # needed
> to be left out?
> I build the kernel and netbsd & netbsd.dbg are created
You mean "netbsd.gdb"?

> I start debugging by booting the kernel with 
>         boot netbsd.dbg -d

You don't actually need to boot with the "big" kernel.  The small one (netbsd)
will work just fine... (gdb needs netbsd.gdb though..)
> Then on the other machine, using 2nd serial port 
>         (gdb) set remotebaud 9600
>         (gdb) target remote /dev/tty01
> Nothing happens. What am I missing?

What does your line for /dev/tty01 in /etc/ttys look like?  Mine looks like:

tty01   "/usr/libexec/getty std.9600"   unknown off secure local

(It's the "local" part that I was missing when I was working on 
getting kgdb going... Once we figured that out (Thanks Christoph! :) ) 
it worked just fine..)
> Is there another way to debug a device driver?

Lots of well-placed printf's? :-> 


Greg Oster