Debugging the kernel (was: More on protocol modules)

Keith Owens (kaos@ocs.com.au)
Thu, 18 Sep 1997 01:22:03 +1000


On Tue, 16 Sep 1997 19:02:00 -0400 (EDT),
"Nicholas J. Leon" <nicholas@binary9.net> wrote:
>And another small question, how do
>you debug (using gdb) a running module?

Two basic methods. Run a serial link to another computer and run gdb
over the serial link. Or run gdb directly on the current kernel. The
latter is more risk because you can easily get into deadlocks. See
http://www.redhat.com:8080/HyperNews/get/khg/15.html for some
discussion.

There is an entry on that thread from David Hinds about using gdb on
the current kernel, in which he says you cannot set breakpoints. John
Heidemann <johnh@isi.edu> modified David's code to add breakpoints but
John's code was against 1.3.30. I have upgraded John's version to
2.1.55 and added code to detect some deadlock conditions and
automatically avoid them. You can get my updated version from
ftp://ftp.ocs.com.au/pub/xkdebug-2.1.55.tgz.

[DANGER WILL ROBINSON]. Setting breakpoints and single stepping your
live kernel is a dangerous exercise. If it crashes your kernel, erases
your hard disk or sends /etc/shadow to crack.com, don't blame me. You
have been warned.