Solaris Modular Debugger Guide

Appendix C Transition From adb

The transition from using the legacy adb(1) utility to using mdb(1) is relatively simple: MDB provides evolutionary compatibility for the adb syntax, built-in commands, and command-line options. MDB attempts to provide compatibility for all existing adb(1) features, but it is not bug-for-bug compatible with adb(1). This appendix briefly discusses several features of adb(1) that are not precisely emulated by mdb(1) in order to guide users to the new functionality

Command-line Options

MDB provides a superset of the command-line options recognized by adb(1). All the adb(1) options are supported and have the same meaning as before. The /usr/bin/adb pathname is delivered as a link that invokes mdb(1), and automatically enables enhanced adb(1) compatibility mode. Executing the /usr/bin/adb link is equivalent to executing mdb with the -o adb option, or executing ::set -o adb once the debugger has started.


The MDB language adheres to the same syntax as the adb(1) language, in order to provide compatibility for legacy macros and script files. New MDB dcmds use the extended form ::name, in order to distinguish them from legacy commands that are prefixed with either : or $. 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 ($[ ]). Similar to adb(1), an input line that begins with an exclamation mark (!) 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.

In adb(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 Binary Operators. The operators conform to the order of precedence in ANSI C. Legacy adb(1) macro files that do not explicitly parenthesize ambiguous expressions may need to be updated to work with MDB. For example, in adb the following command evaluates to the integer value nine:

$ echo "4-1*3=X" | adb

In MDB, as in ANSI C, operator "*" has higher precedence than "-" and therefore the result is the integer value one:

$ echo "4-1*3=X" | mdb

Watchpoint Length Specifier

The watchpoint length specifier syntax recognized by MDB is different from the syntax described in adb(1). In particular, the adb watchpoint commands :w, :a, and :p 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 adb(1) commands:


are specified in MDB as


The MDB ::wp dcmd provides more complete facilities for creating user process watchpoints.

Address Map Modifier

The adb(1) commands to modify segments of the virtual address map and object file map are not present in MDB. Specifically, the /m, /*m, ?m, and ?*m 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.


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 adb commands will need to revalidate and update such scripts as part of the transition to MDB.