Subject: Re: Debugging tools...
To: Dante Profeta <dante@mclink.it>
From: Frank van der Linden <frank@wins.uva.nl>
List: tech-kern
Date: 07/11/1998 16:54:14
On Sat, Jul 11, 1998 at 02:07:06PM +0200, Dante Profeta wrote:
> KPrintF() was a debug.library function which did dump a string to the
> serial port, and it was very useful in some situations where the output
> couldn't be sent to an Intuition window, so to catch the result on
> another computer in terminal emulation mode.
> 
> Well, I think such a function would be very useful at NetBSD boot time
> to debug a driver.
> Is there anything similar into NetBSD kernel?

I'm not exactly sure what you are trying to debug, but there is also
kgdb via a serial line. Compile a kernel with

makeoptions     DEBUG="-g"

in the config file, and also (i386 example):

options         KGDB
options         KGDBRATE=38400
options         KGDBADDR=0x2f8

This means that it's using the 2nd serial port at 38400 bps to connect
with gdb on the other machine. If you hook up a nulmodem cable to that
serial port, and have another machine (on which you compiled the kernel
and have the sources), you'd start debugging as follows (i386 example
again):

	- boot the kernel with 'boot netbsd -d'

on the other machine, given that the nulmodem cable is plugged in to
the 3rd serial port there:

	% cd <your_compile_dir>
	% gdb
	(gdb) set remotebaud 38400
	(gdb) set remotebreak
	(gdb) target remote /dev/tty02

Once the connection has been established, you can use gdb as you would
normally.

- Frank