<appendix id="crash-4"><title>Transition From <command>crash</command></title><highlights><para><indexterm><primary><literal>crash(1M)</literal></primary></indexterm>The transition from using the legacy <command>crash</command>
utility to using <olink targetdoc="refman1" targetptr="mdb-1" remap="external"><citerefentry><refentrytitle>mdb</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink>
is relatively simple: MDB provides most of the &ldquo;canned&rdquo; 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 <command>crash</command> and provides pointers to equivalent MDB functionality. </para>
</highlights><sect1 id="crash-5"><title>Command-line Options</title><para>The <literal>crash</literal> <option>d</option>, <option>n</option>,
and <option>w</option> command-line options are not supported by <command>mdb</command>. The <literal>crash</literal> dump file and name list (symbol
table file) are specified as arguments to <command>mdb</command> in the order
of name list, crash dump file.  To examine the live kernel, the <literal>mdb</literal> <option>k</option> option should be specified with no additional
arguments.  Users who want to redirect the output of <literal>mdb</literal>
to a file or other output destination, should either employ the appropriate
shell redirection operator following the <command>mdb</command> invocation
on the command line, or use the <command>::log</command> built-in dcmd.</para>
</sect1><sect1 id="crash-1"><title>Input in MDB</title><para>In general, input in MDB is similar to <command>crash</command>, except
that function names (in MDB, dcmd names) are prefixed with &ldquo;<literal>::</literal>&rdquo;.  Some MDB dcmds accept a leading expression argument
that precedes the dcmd name.  Like <command>crash</command>, 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 <command>crash</command>
and MDB as shown in <olink targetptr="crash-tbl-3" remap="internal">Table&nbsp;D&ndash;1</olink>.</para><table frame="topbot" id="crash-tbl-3"><title>Radix Specifiers</title><tgroup cols="3" colsep="0" rowsep="0"><colspec colname="colspec3" colwidth="33*"/><colspec colname="colspec4" colwidth="33*"/><colspec colname="colspec5" colwidth="33*"/><thead><row rowsep="1"><entry><para>crash</para>
</entry><entry><para>mdb</para>
</entry><entry><para>Radix</para>
</entry>
</row>
</thead><tbody><row><entry><para>0x</para>
</entry><entry><para>0x</para>
</entry><entry><para>hexadecimal (base 16)</para>
</entry>
</row><row><entry><para>0d</para>
</entry><entry><para>0t</para>
</entry><entry><para>decimal (base 10)</para>
</entry>
</row><row><entry colname="colspec3"><para>0b</para>
</entry><entry colname="colspec4"><para>0i</para>
</entry><entry colname="colspec5"><para>binary (base 2)</para>
</entry>
</row>
</tbody>
</tgroup>
</table><para>Many <command>crash</command> commands accepted slot numbers or slot
ranges as input arguments. The Solaris operating system is no longer structured
in terms of slots, so MDB dcmds do not provide support for slot-number processing.</para>
</sect1><sect1 id="crash-2"><title>Functions</title><informaltable frame="topbot"><tgroup cols="3" colsep="0" rowsep="0"><colspec colname="colspec0" colwidth="18.00*"/><colspec colname="colspec1" colwidth="18.25*"/><colspec colname="colspec2" colwidth="62.75*"/><thead><row rowsep="1"><entry><para>crash function</para>
</entry><entry><para>mdb
dcmd</para>
</entry><entry><para>Comments</para>
</entry>
</row>
</thead><tbody><row><entry><para>?</para>
</entry><entry><para>::dcmds</para>
</entry><entry><para>List available functions.</para>
</entry>
</row><row><entry><para>!command</para>
</entry><entry><para>!command</para>
</entry><entry><para>Escape to the shell and execute command.</para>
</entry>
</row><row><entry><para>base</para>
</entry><entry><para>=</para>
</entry><entry><para>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.</para>
</entry>
</row><row><entry><para>callout</para>
</entry><entry><para>::callout</para>
</entry><entry><para>Print the callout table.</para>
</entry>
</row><row><entry><para>class</para>
</entry><entry><para>::class</para>
</entry><entry><para>Print scheduling classes.</para>
</entry>
</row><row><entry><para>cpu</para>
</entry><entry><para>::cpuinfo</para>
</entry><entry><para>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 <?Pub _nolinebreak?><literal>$&lt;cpu</literal><?Pub /_nolinebreak?>
macro to the CPU address in mdb.</para>
</entry>
</row><row><entry><para>help</para>
</entry><entry><para>::help</para>
</entry><entry><para>Print a description of the named dcmd, or general help information.</para>
</entry>
</row><row><entry><para>kfp</para>
</entry><entry><para>::regs</para>
</entry><entry><para>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.</para>
</entry>
</row><row><entry><para>kmalog</para>
</entry><entry><para>::kmalog</para>
</entry><entry><para>Display events in kernel memory allocator transaction log.</para>
</entry>
</row><row><entry><para>kmastat</para>
</entry><entry><para>::kmastat</para>
</entry><entry><para>Print kernel memory allocator transaction log.</para>
</entry>
</row><row><entry><para>kmausers</para>
</entry><entry><para>::kmausers</para>
</entry><entry><para>Print information about the medium and large users of the kernel
memory allocator that have current memory allocations.</para>
</entry>
</row><row><entry><para>mount</para>
</entry><entry><para>::fsinfo</para>
</entry><entry><para>Print information about mounted file systems.</para>
</entry>
</row><row><entry><para>nm</para>
</entry><entry><para>::nm</para>
</entry><entry><para>Print symbol type and value information.</para>
</entry>
</row><row><entry><para>od</para>
</entry><entry><para>::dump</para>
</entry><entry><para>Print a formatted memory dump of a given region. In mdb, ::dump displays a
mixed ASCII and hexadecimal display of the region.</para>
</entry>
</row><row><entry><para>proc</para>
</entry><entry><para>::ps</para>
</entry><entry><para>Print a table of the active processes.</para>
</entry>
</row><row><entry colname="colspec0"><para>quit</para>
</entry><entry colname="colspec1"><para>::quit</para>
</entry><entry colname="colspec2"><para>Quit the debugger.</para>
</entry>
</row><row><entry colname="colspec0"><para>rd</para>
</entry><entry colname="colspec1"><para>::dump</para>
</entry><entry colname="colspec2"><para>Print a formatted memory
dump of a given region. In mdb, ::dump displays a mixed ASCII and hexadecimal
display of the region.</para>
</entry>
</row><row><entry><para>redirect</para>
</entry><entry><para>::log</para>
</entry><entry><para>In mdb, output for input and output can be globally redirected
to a log file using ::log.</para>
</entry>
</row><row><entry><para>search</para>
</entry><entry><para>::kgrep</para>
</entry><entry><para>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.</para>
</entry>
</row><row><entry><para>stack</para>
</entry><entry><para>::stack</para>
</entry><entry><para>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 <literal>$&lt;stackregs</literal>
macro can be applied to a stack pointer to obtain the per-frame saved register
values.</para>
</entry>
</row><row><entry><para>status</para>
</entry><entry><para>::status</para>
</entry><entry><para>Display status information about the system or dump being examined
by the debugger.</para>
</entry>
</row><row><entry colname="colspec0"><para>stream</para>
</entry><entry colname="colspec1"><para>::stream</para>
</entry><entry colname="colspec2"><para>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.</para>
</entry>
</row><row><entry colname="colspec0"><para>strstat</para>
</entry><entry colname="colspec1"><para>::kmastat</para>
</entry><entry colname="colspec2"><para>The ::kmastat dcmd
displays a superset of the information reported by the <command>strstat</command>
function.</para>
</entry>
</row><row><entry colname="colspec0"><para>trace</para>
</entry><entry colname="colspec1"><para>::stack</para>
</entry><entry colname="colspec2"><para>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 <literal>$&lt;stackregs</literal> macro can be applied to a stack pointer
to obtain the per-frame saved register values.</para>
</entry>
</row><row><entry colname="colspec0"><para>var</para>
</entry><entry colname="colspec1"><para>$&lt;v</para>
</entry><entry colname="colspec2"><para>Print the tunable system
parameters in the global <structname>var</structname> structure.</para>
</entry>
</row><row><entry colname="colspec0"><para>vfs</para>
</entry><entry colname="colspec1"><para>::fsinfo</para>
</entry><entry colname="colspec2"><para>Print information about
mounted file systems.</para>
</entry>
</row><row><entry colname="colspec0"><para>vtop</para>
</entry><entry colname="colspec1"><para>::vtop</para>
</entry><entry colname="colspec2"><para>Print the physical address
translation of the given virtual address.</para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</sect1>
</appendix>