options DEBUG="-g" # build bsd.gdb with full symbol table options KGDB # cross-system kernel debugger options "KGDBRATE=9600" # remote debugging baud rate options "KGDBDEV=0x800001" # kgdb device, tty01It is best to build the kernel on the host machine and copy the resulting bsd to the remote machine. Once running with the new bsd you can start up gdb on the host machine:
# gdb -k bsd.gdband the to attach you would us a command similar to:
(gdb) target remote /dev/tty01You might also find
(gdb) set remote-text-refs offto be useful. Finally, use:
(gdb) contto allow the remote machine to continue to run. Use <CTRL-C> to halt the remote machine and get back into gdb. You can use break points, do back traces, etc. If the remote machine panics you should find yourself back in gdb.
If you do panic, you can use the command:
(gdb) jump bootto reboot in most cases. After doing this, if you want to kill gdb you will need to suspend it with <CTRL-Z> and then kill -9 the process.