---

Built-In Kernel Debugger

Scott Lurndal from
Silicon Graphics wrote on linux-kernel:

Greetings,

I have written a built-in kernel debugger for the Linux
operating system on Intel 32-bit Architecture platforms.

It is being made available for general use and abuse under the
standard linux licensing terms (see ./COPYING in the linux source
distribution).

The debugger is part of the linux kernel and provides a means of
examining kernel memory and data structures while the system is
operational. Additional commands may be easily added to format and
display essential system data structures given an identifier or
address of the data structure. Current command set allows complete
control of kernel operations including single-stepping a processor,
stopping upon execution of a specific instruction, stopping upon
access (or modification) of a specific virtual memory location,
stopping upon access to a register in the input-output address
space, stack tracebacks for the current active task as well as for
all other tasks (by process id), instruction disassembly, et.
al.

To use the kernel debugger, unzip the patch found at

http://reality.sgi.com/slurn_engr/

and apply the patch as normal to your linux 2.2.3 or 2.2.4
source tree (it hasn’t been tested yet with 2.2.5). Configure the
new kernel ensuring that the CONFIG_KDB and CONFIG_KDB_FRAMEPTR
configuration options are enabled (via xconfig, menuconfig,
oldconfig or config make options).

Version 0.1 of the built-in kernel debugger for Linux provides
the following features:

  • Instruction Breakpoints
  • Data Access Breakpoints
  • Single Instruction Execution
  • Stack tracebacks
  • Stack traceback for arbitrary processes
  • Ability to switch cpus in SMP system
  • Memory examination and modification
  • Instruction disassembly
  • Access to static and global symbols by name
  • Register access and modification

After applying the kernel debugger patch to a 2.2.3 or 2.2.4
source tree and recompiling, one can enter the debugger in the
following ways:

  • An ooops will cause the debugger to be invoked
    automatically
  • Likewise a data access fault in kernel mode
  • Using the ‘kdb’ flag on the lilo command line
  • Using the ‘pause’ key

—-

Let me know what you think at slurn@engr.sgi.com

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends, & analysis