Open Source

What is KDB ?
How is KDB different from gdb ?
After typing 'go' the keyboard doesn't respond
I get an error message compiling ksym.c
How can I use kdb over a serial port?
What does the 'kdb' flag to lilo do?
Why does my kernel reset the machine?
Why do I get "/sbin/kallsyms not found" at compile time?

What is KDB ?

KDB is a built-in Kernel DeBugger for linux 2.[234]-based kernels. It allows an individual to establish breakpoints, examine and alter memory contents, and determine process state without an external system or serial port. It allows control of multiple processors.

How is KDB different from gdb ?

To use gdb, one must have a serial cable and another system upon which gdb can be executed; not all environments are so equipped.

gdb doesn't handle multi-processor systems as well as KDB.

After typing 'go', my keyboard no longer responds and the system appears hung

The kernel debugger has trouble with some keyboard controllers (this is a bug in kdb), and will appear to hang after typing 'go'. When this occurs, one way to unhang the keyboard controller is to remote login to your system (via rsh, rlogin or telnet) and as root restart the 'gpm' subsystem

# /usr/bin/sh /etc/rc.d/init.d/gpm restart

Note: This may be fixed in v0.6 - please let me know if it isn't.

I get the following message when compiling ksym.c

warning: excess elements in array initializer after `__kdbsymtab'

For v0.6 and greater, you must adjust the kdb symbol table size using the CONFIG_KDBSTBSIZE config parameter.

For v0.5 and prior, this error occurs when the number of symbols in the kernel exceeds the maximum defined for the kernel debugger symbol table (the symbolic constant KDBMAXSYMTABSIZE in scripts/genkdbsym.awk). You must increase the value of KDBMAXSYMTABSIZE to continue. You must also increase the kdb symbol table space reservation in arch/i386/

CONFIG_KDBSTBSIZE and changes to arch/i386/ are not required for kdb v1.2 onwards.

How can I use kdb over a serial port?

First, using a null modem serial cable to connect a serial port from the system under test to your remote terminal (or terminal emulator). Second, follow the instructions in the file 'Documentation/serial.txt' in the kernel source tree and set up the port you connected as a serial console.

Upon reboot, the first serial console in a kdb-enabled kernel will be chosen as the kdb serial console. The kernel debugger cannot be entered via keystroke until the serial port is opened by user-space code (e.g. mingetty), but once mingetty has started, the CNTRL-A sequence may be used to enter the kernel debugger. If it is necessary to debug the kernel at some point prior to multi-user mode, you can use the 'kdb' flag to lilo to enter the debugger early and set breakpoints as necessary.

What does the 'kdb' flag to lilo do?

If the 'kdb' flag is specified on the lilo command line, the system will automatically stop in the kernel debugger at two points during early system initialization. This allows the individual to establish breakpoints in driver initialization functions and other kernel intialization areas.

Why does my kernel reset the machine? (v0.5 and earlier)

If you have increased the symbol table size, without increasing the amount of space reserved for the symbol table in the linker layout directives file, arch/i386/, the kdb symbol table may overlap the block storage section in the resultant kernel image causing data corruption which will cause the processor to triple fault and reset during the initial boot load. Increase the amount of space allocated to the kdb symbol table in to resolve this.

Why do I get "/sbin/kallsyms not found" at compile time?

kdb v1.2 needs modutils >= 2.3.11 installed to build and maintain the debugging symbol table. This replaces the manual setting of CONFIG_KDBSTBSIZE and provides better debugging information.