Debugging

There is an online kernel debugger, for examing state while running and playing hangman
with the kernel symbol list.
You can "crash dump" here if you have enough disk space, and debug later.

Or you can run a multiple computer setup with kgdb, over serial line.

Userland tools
monitor interrupt usage with 'systat vm'
monitor mbuf usage with 'netstat -m'
monitor packet counts/errors with 'netstat -i'

Use macros for debug messages, verbosity can be changed via ddb.

   #ifdef HPA_DEBUG
   int hpadebug = 0;
   #define DPRINTF(x)         do { if (hpadebug) printf x; } while (0)
   #define DPRINTFN(n,x)   do { if (hpadebug >= (n)) printf x; } while (0) 
   #else
   #define DPRINTF(x)
   #define DPRINTFN(n,x)
   #endif 

   DPRINTF(2, ("%s: link state changed\n", sc->sc_dev.dv_xname));