<?Pub CX solbook(?><appendix id="adb-trans-1"><?Pub Tag atict:info tracking="off" ref="0"?><?Pub Tag
atict:user user="ae149097" fullname="Alta Elstad"?><title>Transition From <command>adb</command> and <command>kadb</command></title><highlights><para>The transition from using the legacy <literal>adb</literal>(1) utility
to using <literal>mdb</literal>(1) is relatively simple: MDB provides evolutionary
compatibility for the <literal>adb</literal> syntax, built-in commands, and
command-line options. MDB attempts to provide compatibility for all existing <literal>adb</literal>(1) features, but it is not bug-for-bug compatible with <literal>adb</literal>(1). This appendix briefly discusses several features of <literal>adb</literal>(1)
that are not precisely emulated by <literal>mdb</literal>(1) in order to guide
users to the new functionality</para>
</highlights><sect1 id="adb-trans-6"><title>Command-line Options</title><para>MDB provides a superset of the command-line options recognized by <literal>adb</literal>(1). All the <literal>adb</literal>(1) options are supported
and have the same meaning as before. The <filename>/usr/bin/adb</filename> pathname
is delivered as a link that invokes <literal>mdb</literal>(1), and automatically
enables enhanced <literal>adb</literal>(1) compatibility mode. Executing the <filename>/usr/bin/adb</filename> link is equivalent to executing mdb with the <option>o</option> <literal>adb</literal> option, or executing <literal>::set -o adb</literal> once the
debugger has started. </para>
</sect1><sect1 id="adb-trans-7"><title>Syntax</title><para>The MDB language adheres to the same syntax as the <literal>adb</literal>(1)
language, in order to provide compatibility for legacy macros and script files.
New MDB dcmds use the extended form <literal>::name</literal>, in order to
distinguish them from legacy commands that are prefixed with either <literal>:</literal> or <literal>$</literal>. Expressions can also be evaluated on the right-hand side of a
dcmd name by enclosing them in square brackets preceded by a dollar sign (<literal>$[ ]</literal>). Similar to <literal>adb</literal>(1), an input line that
begins with an exclamation mark (<literal>!</literal>) indicates that the
command line should be executed by the user's shell. In MDB, a debugger command
may also be suffixed with an exclamation mark to indicate that its output
should be piped to the shell command following the exclamation mark.</para><para>In <literal>adb</literal>(1), binary operators are left associative
and have lower precedence than unary operators. Binary operators are evaluated
in strict left-to-right order on the input line. In MDB, binary operators
are left associative and have lower precedence than unary operators, but the
binary operators operate in order of precedence according to the table in <olink targetptr="syntax-19" remap="internal">Binary Operators</olink>. The operators conform to the
order of precedence in ANSI C. Legacy <literal>adb</literal>(1) macro files
that do not explicitly parenthesize ambiguous expressions may need to be updated
to work with MDB. For example, in <literal>adb</literal> the following command
evaluates to the integer value nine:</para><screen>$ echo "4-1*3=X" | adb
        9</screen><para>In MDB, as in ANSI C, operator <literal>*</literal> has higher precedence
than <literal>-</literal> and therefore the result is the integer value
one:</para><screen>$ echo "4-1*3=X" | mdb
        1</screen>
</sect1><sect1 id="adb-trans-8"><title>Watchpoint Length Specifier</title><para>The watchpoint length specifier syntax recognized by MDB is different
from the syntax described in <literal>adb</literal>(1). In particular, the <literal>adb</literal> watchpoint commands <literal>:w</literal>, <literal>:a</literal>,
and <literal>:p</literal> allow an integer length in bytes to be inserted
between the colon and the command character. In MDB, the count should be specified
following the initial address as a repeat count. Stated simply, these <literal>adb</literal>(1) commands:</para><screen>123:456w
123:456a
123:456p</screen><para>are specified in MDB as</para><screen>123,456:w
123,456:a
123,456:p</screen><para>The MDB <literal>::wp</literal> dcmd provides more complete facilities
for creating user process watchpoints. Similarly, the legacy <command>kadb</command> length
modifier command <literal>$l</literal> is not supported. Therefore, the watchpoint
size should be specified to each&nbsp;<literal>::wp</literal> command used
in <command>kmdb</command>.</para>
</sect1><sect1 id="adb-trans-9"><title>Address Map Modifier</title><para>The <literal>adb</literal>(1) commands to modify segments of the virtual
address map and object file map are not present in MDB. Specifically, the <literal>/m</literal>, <literal>/*m</literal>, <literal>?m</literal>, and <literal>?*m</literal> format
specifiers are not recognized or supported by MDB. These specifiers were used
to manually modify the valid addressable range of the current object and core
files. MDB properly recognizes the addressable range of such files automatically,
and updates the ranges when a live     process is being debugged, so these
commands are no longer necessary. </para>
</sect1><sect1 id="adb-trans-10"><title>Output</title><para>The precise text output form of some commands is different in MDB. Macro
files are formatted using the same basic rules, but shell scripts that depend
on the precise character-by-character output of certain commands may need
to change. Users who have shell scripts that parse the output of <literal>adb</literal> commands
will need to revalidate and update such scripts as part of the transition
to MDB. </para>
</sect1><sect1 id="adb-trans-11"><title>Deferred Breakpoints</title><para>The legacy <command>kadb</command> utility supported a syntax for deferred
breakpoints that was incompatible with the existing <command>adb</command> syntax.
These deferred breakpoints were specified using the syntax <literal></literal><replaceable>module</replaceable><literal>#</literal><replaceable>symbol</replaceable><literal>:b</literal> in <command>kadb</command>. To set a deferred breakpoint in <command>kmdb</command>, use the MDB <literal>::bp</literal> dcmd as described in <olink targetptr="chp-exec" remap="internal">Chapter&nbsp;6, Execution Control</olink>.</para>
</sect1><sect1 id="adb-trans-12" arch="x86"><title>I/O Port Access</title><para>The legacy <command>kadb</command> utility provided access to I/O ports
on x86 systems using the <command>:i</command> and <command>:o</command> commands.
These commands are not supported in <command>mdb</command> or <command>kmdb</command>.
Access to I/O ports on x86 systems is provided by the <command>::in</command> and <command>::out</command> commands.</para>
</sect1>
</appendix><?Pub *0000007032 0?>