Specifications

D
evice Driver Programming
15-18
the starting address of the stack, list the registers with the panic
command.
proc List the process table. Use this information to obtain the process
slot number of the process that panicked the system.
stack Dump the stack. Use this information to determine the size of the
stack frame. If stack returns information that you suspect is cor-
rupted, use proc to get a list of process table slots and then use
stack on each individual slot entry.
stat List system statistics. Use this information to display the reason a
panic occurred. The panic command gives the same information
as stat, plus registers, stack, and trace data.
trace Print kernel stack trace. Use this information to determine which
functions were executed in the stack or in an individual process
table slot entry.
Using crash Commands 15
When a panic occurs, capture the core memory image and produce a file that you can use
with crash. When crash executes, a “>” command line prompt is displayed. The fol-
lowing sequence of commands are frequently used to analyze the problem.
stat list reason for the crash
proc list the process table to see which process initiated the panic
stack or trace list the last processes on the stack
dis trace the execution of a set of instructions
Kernel Debugger 15
An extremely useful tool for debugging device drivers is the kernel debugger (also known
as kdb). Refer to the kdb(1M) manual page in the system administration reference
manual for more details and a complete list of commands for the kdb utility.
kdb can set breakpoints, display kernel stack traces and various kernel structures, and
modify the contents of memory, I/O, and registers. The debugger supports basic arithmetic
operations, conditional execution, variables, and macros. kdb does conversions from a
kernel symbol name to its virtual address, from a virtual address to the value at that
address, and from a virtual address to the name of the nearest kernel symbol. You have a
choice of different numeric bases, address spaces, and operand sizes. kdb can be used to
reference global symbols that are inside of DLMs (Dynamically Loaded Modules) and set
breakpoints inside of DLM modules using routine names and offsets (a feature not avail-
able via the console processor).
To use the debugger, you must first configure it into the kernel. Then you can invoke the
debugger by using the kdb command or the syscx(DEBUGGER) system call, or by enter-
ing the sequence CTRL-~-k (from the console only). In addition, kdb is entered auto-