This document describes kernel debugging in FreeBSD. The main source of this is in the FreeBSD handbook section on kernel debugging, sections 22.3 and 22.4. This document is merely an appendix to that information for specifics relevant to our lab. I suggest you read the documentation there to understand the main steps and then read over these notes.
Connect a serial cable between the machine you want to debug, let's call it KERNEL, and a convenient FreeBSD machine, DEBUG. You can pick the closest one and just telnet to it from your workstation.
Once you have the serial cable you just need to make sure you have permission to the serial device (/dev/cuaa0 or /dev/cuaa1) on DEBUG. Normally this device's permissions are read and write for owner and group only, with a group of uucp. I just added myself to the group uucp in /etc/group.
I have also found you don't have to start the machine you want to
debug with the -d switch unless you want to debug something that
occurs at startup. Using the hotkey sequence, I have trouble with bounce buffers when using a debug kernel. Here
are three things to do if you're crashing because of those when you
try to run a debug kernel:
One other thing (just because I spent a day or two figuring it
out): Don't assume vars are initialized to zero by default. Don't
even assume they get the same default value on consecutive calls to
the same function. Yes, I know we're not supposed to assume this
anyway.
More tips:
options MAXMEM=16384
Summary
Other DiRT documents
Author: Mark Parris
Last updated: February 23, 1998