<?Pub UDT _bookmark _target?><?Pub EntList amp nbsp gt lt ndash hyphen?><?Pub CX solbook(book(title()bookinfo()chapter(10)?><appendix id="options-1"><title>Options</title><highlights><para>This appendix provides a reference for MDB command-line options.</para>
</highlights><sect1 id="options-2"><title>Summary of Command-line Options</title><screen>mdb [ -fkmuwyAFMS ]  [ +o option ]  [ -p pid ]  [ -s distance]   
     [ -I path ]  [ -L path ]  [ -P prompt ]  [ -R root ]  
     [ -V dis-version ]  [ object  [ core ]  | core  | suffix ]</screen><para>The following options are supported:</para><variablelist termlength="xtranarrow"><varlistentry><term><option>A</option></term><listitem><para>Disables automatic loading of <command>mdb</command> modules.
By default, <command>mdb</command> attempts to load debugger modules corresponding
to the active shared libraries in a user process or core file, or to the loaded
kernel modules in the live operating system or an operating system crash dump.</para>
</listitem>
</varlistentry><varlistentry><term><option>F</option></term><listitem><para>Forcibly takes over the specified user process, if necessary.
By default, <command>mdb</command> refuses to attach to a user process that
is already under the control of another debugging tool, such as <olink targetdoc="refman1" targetptr="truss-1" remap="external"><citerefentry><refentrytitle>truss</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink>. With the <option>F</option> option, <command>mdb</command> attaches to these processes anyway. This can produce unexpected
interactions between <command>mdb</command> and the other tools attempting
to control the process.</para>
</listitem>
</varlistentry><varlistentry><term><option>f</option></term><listitem><para>Force raw file debugging mode. By default, <command>mdb</command> attempts
to infer whether the object and core file operands refer to a user executable
and core dump or to a pair of operating system crash dump files. If the file
type cannot be inferred, the debugger will default to examining the files
as plain binary data. The <option>f</option>option forces <command>mdb</command> to
interpret the arguments as a set of raw files to examine</para>
</listitem>
</varlistentry><varlistentry><term><option>I</option></term><listitem><para>Sets default path for locating macro files. Macro files are
read using the <command>$&lt;</command> or <command>$&lt;&lt;</command> dcmds.
The path is a sequence of directory names delimited by colon ( <literal>:</literal>)
characters. The <option>I</option> <literal>include</literal> path and <option>L</option> <literal>library</literal> path (see below) can also contain any of the following tokens:</para><variablelist termlength="xtranarrow"><varlistentry><term>%i</term><listitem><para>Expands to the current instruction set architecture (ISA)
name: <literal>sparc</literal>, <literal>sparcv9</literal>, <literal>i386</literal>,
or <literal>amd64</literal>.</para>
</listitem>
</varlistentry><varlistentry><term>%o</term><listitem><para>Expands to the old value of the path being modified. This
is useful for appending or prepending directories to an existing path.</para>
</listitem>
</varlistentry><varlistentry><term>%p</term><listitem><para>Expands to the current platform string (either <command>uname</command> <option>i</option> or the platform string stored in the process core file or crash
dump).</para>
</listitem>
</varlistentry><varlistentry><term>%r</term><listitem><para>Expands to the path name of the root directory. An alternate
root directory can be specified using the <option>R</option> option. If no <option>R</option> option is present, the root directory is derived dynamically from
the path to the <command>mdb</command> executable itself. For example, if <command>/bin/mdb</command> is executed, the root directory is <filename>/</filename>.
 If <command>/net/hostname/bin/mdb</command> were executed, the root directory
would be derived as <filename>/net/hostname</filename>.</para>
</listitem>
</varlistentry><varlistentry><term>%t</term><listitem><para>Expands to the name of the current target. This is either
the literal string '<literal>proc</literal>' (a user process or user process
core file), or '<literal>kvm</literal>' (a kernel crash dump or the live operating
system).</para>
</listitem>
</varlistentry>
</variablelist><para>The default include path for 32-bit <command>mdb</command> is:<literal>%r/usr/platform/%p/lib/adb:%r/usr/lib/adb</literal></para><para>The default include path for 64-bit <command>mdb</command> is:<literal>%r/usr/platform/%p/lib/adb/%i:%r/usr/lib/adb/%i</literal></para>
</listitem>
</varlistentry><varlistentry><term><option>k</option></term><listitem><para><indexterm><primary><filename>/dev/ksyms</filename></primary></indexterm><indexterm><primary><filename>/dev/kmem</filename></primary></indexterm>Forces kernel debugging mode. By default, <command>mdb</command> attempts
to infer whether the object and core file operands refer to a user executable
and core dump, or to a pair of operating system crash dump files. The <option>k</option> option
forces <command>mdb</command> to assume these files are operating system crash
dump files. If no object or core operand is specified, but the <option>k</option> option
is specified, <command>mdb</command> defaults to an object file of <filename>/dev/ksyms</filename> and a core file of <filename>/dev/kmem</filename>. Access to <filename>/dev/kmem</filename> is restricted to group sys.</para>
</listitem>
</varlistentry><varlistentry><term><option>K</option></term><listitem><para>Load <command>kmdb</command>, stop the live running operating
system kernel, and proceed to the <command>kmdb</command> debugger prompt.
This option should only be used on the system console, as the subsequent <command>kmdb</command> prompt will appear on the system console.</para>
</listitem>
</varlistentry><varlistentry><term><option>L</option></term><listitem><para>Sets default path for locating debugger modules. Modules are
loaded automatically on startup or by using the <command>::load</command> dcmd.
The path is a sequence of directory names delimited by colon (<literal>:</literal>)
characters. The <option>L</option> library path can also contain any of the
tokens shown for <option>I</option> above.</para>
</listitem>
</varlistentry><varlistentry><term><option>m</option></term><listitem><para>Disables demand-loading of kernel module symbols. By default, <command>mdb</command> processes the list of loaded kernel modules and performs demand
loading of per-module symbol tables. If the <option>m</option> option is specified, <command>mdb</command> does not attempt to process the kernel module list or provide
per-module symbol tables. As a result, <command>mdb</command> modules corresponding
to active kernel modules are not loaded on startup.</para>
</listitem>
</varlistentry><varlistentry><term><option>M</option></term><listitem><para>Preloads all kernel module symbols. By default, <command>mdb</command> performs
demand-loading for kernel module symbols: the complete symbol table for a
module is read when an address is that module's text or data section is referenced.
With the <option>M</option> option, <command>mdb</command> loads the complete
symbol table of all kernel modules during startup.</para>
</listitem>
</varlistentry><varlistentry><term><option>o</option> <replaceable>option</replaceable></term><listitem><para>Enables the specified debugger option. If the <option role="plus">o</option> form of the option is used, the specified option is disabled. Unless
noted below, each option is off by default. <command>mdb</command> recognizes
the following option arguments:</para><variablelist termlength="wholeline"><varlistentry><term>adb</term><listitem><para>Enable stricter <olink targetdoc="refman1" targetptr="adb-1" remap="external"><citerefentry><refentrytitle>adb</refentrytitle><manvolnum>1</manvolnum></citerefentry></olink> compatibility.
The prompt is set to the empty string and many <command>mdb</command> features,
such as the output pager, are disabled.</para>
</listitem>
</varlistentry><varlistentry><term>array_mem_limit=<replaceable>limit</replaceable></term><listitem><para>Set the default limit on the number of array members that <command>::print</command> will display. If <replaceable>limit</replaceable> is the
special token none, all array members will be displayed by default. </para>
</listitem>
</varlistentry><varlistentry><term>array_str_limit=<replaceable>limit</replaceable></term><listitem><para>Set the default limit on the number of characters that <command>::print</command> will attempt to display as an ASCII string when printing a <literal>char</literal> array. If <replaceable>limit</replaceable> is the special token
none, the entire <literal>char</literal> array will be displayed as a <literal>string</literal> by default.</para>
</listitem>
</varlistentry><varlistentry><term>follow_exec_mode=mode</term><listitem><para>Set the debugger behavior for following an exec(2) system
call. The mode should be one of the following named constants:</para><variablelist><varlistentry><term>ask</term><listitem><para>If <literal>stdout</literal> is a terminal device, the debugger
will stop after the exec(2) system call has returned and then prompt the user
to decide whether to follow the exec or stop. If <literal>stdout</literal> is
not a terminal device, the ask mode will default to stop.</para>
</listitem>
</varlistentry><varlistentry><term>follow</term><listitem><para>The debugger will follow the exec by automatically continuing
the target process and resetting all of its mappings and symbol tables based
on the new executable. The follow behavior is discussed in more detail under <olink targetptr="exec-ctrl-12" remap="internal">Interaction With exec</olink>.</para>
</listitem>
</varlistentry><varlistentry><term>stop</term><listitem><para>The debugger will stop following return from the exec system
call.  The stop behavior is discussed in more detail under <olink targetptr="exec-ctrl-12" remap="internal">Interaction With exec</olink>.</para>
</listitem>
</varlistentry>
</variablelist>
</listitem>
</varlistentry><varlistentry><term>follow_fork_mode=mode</term><listitem><para>Set the debugger behavior for following a fork(2), fork1(2),
or vfork(2) system call.  The mode should be one of the following named constants:</para><variablelist><varlistentry><term>ask</term><listitem><para>If <literal>stdout</literal> is a terminal device, the debugger
will stop after the fork system call has returned and then prompt the user
to decide whether to follow the parent or child.  If stdout is not a terminal
device, the ask mode will default to parent.</para>
</listitem>
</varlistentry><varlistentry><term>parent</term><listitem><para>The debugger will follow the parent process, and will detach
from the child process and set it running.</para>
</listitem>
</varlistentry><varlistentry><term>child</term><listitem><para>The debugger will follow the child process, and will detach
from the parent process and set it running.</para>
</listitem>
</varlistentry>
</variablelist>
</listitem>
</varlistentry><varlistentry><term>ignoreeof</term><listitem><para>The debugger does not exit when an <systemitem class="macro">EOF</systemitem> sequence
(<literal>^D</literal>) is entered at the terminal. The <command>::quit</command> dcmd
must be used to quit.</para>
</listitem>
</varlistentry><varlistentry><term>nostop</term><listitem><para>Do not stop a user process when attaching to it when the <literal>-p</literal> option is specified or when the <command>::attach</command> or <command>:A</command> dcmds are applied.  The nostop behavior is described in more
detail under <olink targetptr="exec-ctrl-14" remap="internal">Process Attach and Release</olink>.</para>
</listitem>
</varlistentry><varlistentry><term>pager</term><listitem><para>The output pager is enabled (default).</para>
</listitem>
</varlistentry><varlistentry><term>repeatlast</term><listitem><para>If a <symbol>NEWLINE</symbol> is entered as the complete command
at the terminal, <command>mdb</command> repeats the previous command with
the current value of dot. This option is implied by <option>o</option> <command>adb</command>.</para>
</listitem>
</varlistentry><varlistentry><term>showlmid</term><listitem><para>MDB provides support for symbol naming and identification
in user applications that make use of link maps other than LM_ID_BASE and
LM_ID_LDSO, as described in <olink targetptr="syntax-16" remap="internal">Symbol Name Resolution</olink>.
Symbols on link maps other than LM_ID_BASE or LM_ID_LDSO will be shown as <literal>LMlmid`library`symbol</literal>, where <literal>lmid</literal> is the link-map
ID in the default output radix (16). The user may optionally configure MDB
to show the link-map ID scope of all symbols and objects, including those
associated with LM_ID_BASE and LM_ID_LDSO, by enabling the <literal>showlmid</literal> option.
Built-in dcmds that deal with object file names will display link-map IDs
according to the value of showlmid above, including <command>::nm</command>, <command>::mappings</command>, <command>$m</command>, and <command>::objects</command>.</para>
</listitem>
</varlistentry>
</variablelist>
</listitem>
</varlistentry><varlistentry><term><option>p</option> <replaceable>pid</replaceable></term><listitem><para>Attaches to and stops the specified process id. <command>mdb</command> uses
the <filename>/proc/<replaceable>pid</replaceable>/object/a.out</filename> file
as the executable file path name.</para>
</listitem>
</varlistentry><varlistentry><term><option>P</option></term><listitem><para>Sets the command prompt. The default prompt is '<literal>&gt;</literal> '.</para>
</listitem>
</varlistentry><varlistentry><term><option>R</option></term><listitem><para>Sets root directory for path name expansion. By default, the
root directory is derived from the path name of the <command>mdb</command> executable
itself. The root directory is substituted in place of the <literal>%r</literal> token
during path name expansion.</para>
</listitem>
</varlistentry><varlistentry><term><option>s</option> <replaceable>distance</replaceable></term><listitem><para>Sets the symbol matching distance for address-to-symbol-name
conversions to the specified <replaceable>distance</replaceable>. By default, <command>mdb</command> sets the distance to zero, which enables a smart-matching mode.
Each <acronym>ELF</acronym> symbol table entry includes a value V and size
S, representing the size of the function or data object in bytes. In smart
mode, <command>mdb</command> matches an address A with the given symbol if
A is in the range [ V, V + S ). If any non-zero distance is specified, the
same algorithm is used, but S in the given expression is always the specified
absolute distance and the symbol size is ignored.</para>
</listitem>
</varlistentry><varlistentry><term><option>S</option></term><listitem><para><indexterm><primary><filename>.mdbrc</filename></primary></indexterm>Suppresses processing of the user's <filename>~/.mdbrc</filename> file.
By default, <command>mdb</command> reads and processes the macro file <literal>.mdbrc</literal> if one is present in the user's home directory, as defined by $<envar>HOME</envar>. If the <option>S</option> option is present, this file is not
read.</para>
</listitem>
</varlistentry><varlistentry><term><option>u</option></term><listitem><para>Forces user debugging mode. By default, <command>mdb</command> attempts
to infer whether the object and core file operands refer to a user executable
and core dump, or to a pair of operating system crash dump files. The <option>u</option> option
forces <command>mdb</command> to assume these files are not operating system
crash dump files.</para>
</listitem>
</varlistentry><varlistentry><term><option>U</option></term><listitem><para>Unload <command>kmdb</command> if it is loaded. You should
unload <command>kmdb</command> when it is not in use to release the memory
used by the kernel debugger back to the free memory available to the operating
system.</para>
</listitem>
</varlistentry><varlistentry><term><option>V</option></term><listitem><para>Sets disassembler version. By default, <command>mdb</command> attempts
to infer the appropriate disassembler version for the debug target. The disassembler
can be set explicitly using the <option>V</option> option. The <command>::disasms</command> dcmd lists the available disassembler versions.</para>
</listitem>
</varlistentry><varlistentry><term><option>w</option></term><listitem><para>Opens the specified object and core files for writing.</para>
</listitem>
</varlistentry><varlistentry><term><option>y</option></term><listitem><para>Sends explicit terminal initialization sequences for tty mode.
Some terminals require explicit initialization sequences to switch into a
tty mode. Without this initialization sequence, terminal features such as
standout mode might not be available to <command>mdb</command>.</para>
</listitem>
</varlistentry>
</variablelist>
</sect1><sect1 id="options-3"><title>Operands</title><para>The following operands are supported: </para><variablelist><varlistentry><term>object</term><listitem><para>Specifies an ELF format object file to  examine.  <command>mdb</command> provides
 the  ability to examine and edit ELF format executables  (<filename>ET_EXEC</filename>),
 ELF dynamic library files (<filename>ET_DYN</filename>),  ELF  relocatable
object files (<filename>ET_REL</filename>), and operating system <filename>unix.X</filename> symbol table files.</para>
</listitem>
</varlistentry><varlistentry><term>core</term><listitem><para>Specifies an ELF process core file  (<filename>ET_CORE</filename>),
 or an operating system crash dump <filename>vmcore.X</filename> file. If
an ELF core file operand is provided without a corresponding object file, <command>mdb</command> will attempt to infer the name of the executable file that produced
the core using several different algorithms.  If no executable is found, <command>mdb</command> will still execute, but some symbol information may be unavailable.</para>
</listitem>
</varlistentry><varlistentry><term>suffix</term><listitem><para>Specifies the numerical suffix representing a pair of operating
system crash dump files. For example, if the suffix is '<literal>3</literal>', <command>mdb</command> infers that it should  examine  the files  '<filename>unix.3</filename>'
 and  '<filename>vmcore.3</filename>'. The string of digits will not be interpreted
as a suffix if an actual file of the same name is present in the current directory.</para>
</listitem>
</varlistentry>
</variablelist>
</sect1><sect1 id="options-4"><title>Exit Status</title><para>The following exit values are returned:</para><variablelist><varlistentry><term>0</term><listitem><para>Debugger completed execution successfully.</para>
</listitem>
</varlistentry><varlistentry><term>1</term><listitem><para>A fatal error occurred.</para>
</listitem>
</varlistentry><varlistentry><term>2</term><listitem><para>Invalid command line options were specified.</para>
</listitem>
</varlistentry>
</variablelist>
</sect1><sect1 id="options-5"><title>Environment Variables</title><para>The following environment variables are supported:</para><variablelist><varlistentry><term>HISTSIZE</term><listitem><para>This variable is used to determine the maximum  length of
the command history list. If this variable is not present, the default length
is 128.</para>
</listitem>
</varlistentry><varlistentry><term>HOME</term><listitem><para>This variable is used to determine the pathname of the user's
home directory, where a <filename>.mdbrc</filename> file may reside. If this
variable is not present, no <filename>.mdbrc</filename> processing will occur.</para>
</listitem>
</varlistentry><varlistentry><term>SHELL</term><listitem><para>This variable is used to determine the pathname of the shell
used to process shell escapes requested using            the <literal>!</literal> meta-character.
If this variable is not present, <command>/bin/sh</command> is used.</para>
</listitem>
</varlistentry>
</variablelist>
</sect1>
</appendix><?Pub *0000020521 0?>