.\" $OpenBSD: kgdb.7,v 1.6 2003/04/13 11:06:21 jmc Exp $ .\" .\" Copyright (c) 2001 Hugh Graham .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED .\" WARRANTIES, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, .\" INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES .\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR .\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING .\" IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" .Dd August 23, 2001 .Dt KGDB 7 .Os .Sh NAME .Nm kgdb .Nd remote kernel debugging with gdb .Sh DESCRIPTION Should a programmer be dissatisfied with the .Ox kernel's internal debugger .Xr ddb 4 , and have appropriate hardware available, a kernel with .Cm option KGDB may be built to effect remote debugging with .Xr gdb 1 instead. .Pp To prepare for debugging over serial line one would: .Pp .Bl -bullet -offset 3n -compact .It Obtain a second system and a crossover serial cable. .It Connect the systems and test the cable. .It Build a kernel with .Cm option KGDB and .Cm makeoptions DEBUG="-g" . .It Copy the resultant .Pa bsd.gdb to the control system, and boot the corresponding .Pa bsd on the target system. .It On the control system, run gdb on the kernel just copied. .It Issue the command "target remote /dev/<serial port>" within gdb. The target system should enter .Nm at this point. .It Debug as normal and detach when done, the target should resume normal operation. .El .Sh SEE ALSO .Xr gdb 1 , .Xr ddb 4 , .Xr options 4 .Pp gdb info documents and online documentation. .Sh CAVEATS The remote connection will introduce certain latencies a local debugger would not see. .Pp Not available on all architectures.