Transition From crash

The transition from using the legacy crash utility to using mdb(1) is relatively simple: MDB provides most of the “canned” crash commands. The additional extensibility and interactive features of MDB allow the programmer to explore aspects of the system not examined by the current set of commands. This appendix briefly discusses several features of crash and provides pointers to equivalent MDB functionality.

Command-line Options

The crash -d, -n, and -w command-line options are not supported by mdb. The crash dump file and name list (symbol table file) are specified as arguments to mdb in the order of name list, crash dump file. To examine the live kernel, the mdb -k option should be specified with no additional arguments. Users who want to redirect the output of mdb to a file or other output destination, should either employ the appropriate shell redirection operator following the mdb invocation on the command line, or use the ::log built-in dcmd.

Input in MDB

In general, input in MDB is similar to crash, except that function names (in MDB, dcmd names) are prefixed with “::”. Some MDB dcmds accept a leading expression argument that precedes the dcmd name. Like crash, string options can follow the dcmd name. If a ! character follows a function invocation, MDB will also create a pipeline to the specified shell pipeline. All immediate values specified in MDB are interpreted in hexadecimal by default. The radix specifiers for immediate values are different in crash and MDB as shown in Radix Specifiers.

Radix Specifiers

crash

mdb

Radix

0x

0x

hexadecimal (base 16)

0d

0t

decimal (base 10)

0b

0i

binary (base 2)

Many crash commands accepted slot numbers or slot ranges as input arguments. The illumos operating system is no longer structured in terms of slots, so MDB dcmds do not provide support for slot-number processing.

Functions

crash function

mdb dcmd

Comments

?

::dcmds

List available functions.

!command

!command

Escape to the shell and execute command.

base

=

In mdb, the = format character can be used to convert the left-hand expression value to any of the known formats. Formats for octal, decimal, and hexadecimal are provided.

callout

::callout

Print the callout table.

class

::class

Print scheduling classes.

cpu

::cpuinfo

Print information about the threads dispatched on the system CPUs. If the contents of a particular CPU structure are needed, the user should apply the $<cpu macro to the CPU address in mdb.

help

::help

Print a description of the named dcmd, or general help information.

kfp

::regs

The mdb ::regs dcmd displays the complete kernel register set, including the current stack frame pointer. The $C dcmd can be used to display a stack backtrace including frame pointers.

kmalog

::kmalog

Display events in kernel memory allocator transaction log.

kmastat

::kmastat

Print kernel memory allocator transaction log.

kmausers

::kmausers

Print information about the medium and large users of the kernel memory allocator that have current memory allocations.

mount

::fsinfo

Print information about mounted file systems.

nm

::nm

Print symbol type and value information.

od

::dump

Print a formatted memory dump of a given region. In mdb, ::dump displays a mixed ascii and hexadecimal display of the region.

proc

::ps

Print a table of the active processes.

quit

::quit

quit the debugger.

rd

::dump

Print a formatted memory dump of a given region. In mdb, ::dump displays a mixed ascii and hexadecimal display of the region.

redirect

::log

In mdb, output for input and output can be globally redirected to a log file using ::log.

search

::kgrep

In mdb, the ::kgrep dcmd can be used to search the kernel's address space for a particular value. The pattern match built-in dcmds can also be used to search the physical, virtual, or object files address spaces for patterns.

stack

::stack

The current stack trace can be obtained using ::stack. The stack trace of a particular kernel thread can be determined using the ::findstack dcmd. A memory dump of the current stack can be obtained using the / or ::dump dcmds and the current stack pointer. The $<stackregs macro can be applied to a stack pointer to obtain the per-frame saved register values.

status

::status

Display status information about the system or dump being examined by the debugger.

stream

::stream

The mdb ::stream dcmd can be used to format and display the structure of a particular kernel STREAM. If the list of active STREAM structures is needed, the user should execute ::walk stream_head_cache in mdb and pipe the resulting addresses to an appropriate formatting dcmd or macro.

strstat

::kmastat

The ::kmastat dcmd displays a superset of the information reported by the strstat function.

trace

::stack

The current stack trace can be obtained using ::stack. The stack trace of a particular kernel thread can be determined using the ::findstack dcmd. A memory dump of the current stack can be obtained using the / or ::dump dcmds and the current stack pointer. The $<stackregs macro can be applied to a stack pointer to obtain the per-frame saved register values.

var

$<v

Print the tunable system parameters in the global var structure.

vfs

::fsinfo

Print information about mounted file systems.

vtop

::vtop

Print the physical address translation of the given virtual address.