Source level debugging with kdb

Keith Owens kaos at melbourne.sgi.com
Thu Sep 21 03:25:52 PDT 2000


On Thu, 21 Sep 2000 12:12:24 +0200, 
"Andi Kleen" <ak at suse.de> wrote:
>Actually there is some old patch that allows local kernel debugging
>with gdb via a gdb stub that works via a character device (it used to be 
>in ikd), but of course it is a very very risky thing because you can easily 
>deadlock yourself.

Same problem, the gdb stub for local source level kernel debugging
(xkgdb) requires a functioning kernel, both for gdb and for the stub.
kdb is deliberately aimed at a lower level, where the kernel is frozen
during debugging and the debugger uses the absolute minimum of kernel
services.

You are right, it is incredibly easy to deadlock doing debugging on the
local kernel.  Just put a break point anywhere that gdb needs, or in
any code running with interrupts disabled, or in the screen handler,
then it is time for the big red button.

I used to use xkgdb and did some patches for it to overcome some of its
disadvantages, but xkgdb has too many restrictions on where it can be
used to be useful for real kernel work.  It is OK for higher levels of
the kernel such as device drivers or file systems, but even then you
have to make sure you do not interrupt while the kernel holds any locks
that you need in order to talk to gdb.




More information about the kdb mailing list