kernel debugging with gdb
Should a programmer be dissatisfied with the OpenBSD
kernel's internal debugger
, and have
appropriate hardware available, a kernel with option
may be built to effect remote debugging with
To prepare for debugging over serial line one would:
- Obtain a second system and a crossover serial
- Connect the systems and test the cable.
- Build a kernel with option
KGDB and makeoptions
- Copy the resultant bsd.gdb
to the control system, and boot the corresponding
bsd on the target system.
- On the control system, run gdb on the kernel just
- Issue the command "target remote /dev/<serial
port>" within gdb. The target system should enter
kgdb at this point.
- Debug as normal and detach when done, the target should
resume normal operation.
gdb info documents and online documentation.
The remote connection will introduce certain latencies a local debugger would
Not available on all architectures.