Appendix B. Debugging

This appendix contains information about debuggers and the debugging process.

The following tables list some useful commands of the Solaris Modular Debugger (mdb). For a complete list of available commands, see the Solaris Modular Debugger Guide.[91]

Command

Description

mdb program

Starts mdb with program to debug.

mdb unix.<n> vmcore.<n>

Runs mdb on a kernel crash dump (unix.<n> and vmcore.<n> can typically be found in the directory /var/crash/<hostname>).

$q

Exits the debugger.

Command

Description

::run arguments

Runs the program with the given arguments. If the target is currently running or it is a corefile, mdb will restart the program if possible.

Command

Description

address::bp

Sets a new breakpoint at the address of the breakpoint location that is specified in the command.

$b

Lists information about existing breakpoints.

::delete number

Removes previously set breakpoints specified by their number.

Command

Description

:s

Executes a single instruction. Will step into subfunctions.

:e

Executes a single instruction. Will not enter subfunctions.

:c

Resumes execution.

Command

Description

address,count format

Prints the specified number of objects (count) found at address in the specified format; example formats include B (hexadecimal, 1-byte), X (hexadecimal, 4-byte), S (string).

Command

Description

$r

Lists registers and their contents.

$c

Prints a backtrace of all stack frames.

address::dis

Dumps a range of memory around address as machine instructions.

Command

Description

::status

Prints a summary of information related to the current target.

::msgbuf

Displays the message buffer, including all console messages up to a kernel panic.