Syntax
MDB processes commands from standard input. If standard input is a terminal, MDB
provides terminal editing capabilities. MDB can also process commands from macro files and
from dcmd pipelines, as described below.
The MDB language syntax defines the following behavior:
Compute the value of an expression. This value typically is a memory address in the target. The current address location is referred to as dot. Use the dot or period character (.) to reference the value of the current address.
Apply a dcmd to the computed address.
A metacharacter is a newline, space, or tab character, or one of the
following characters:
[ ] | ! / \ ? = > $ : ;
A blank is a TAB or a SPACE. A word is a sequence of
characters separated by one or more non-quoted metacharacters. . An identifier is
a sequence of letters, digits, underscores, periods, or back quotes beginning with a
letter, underscore, or period. Identifiers are used as the names of symbols, variables,
dcmds, and walkers. Commands are delimited by a NEWLINE or semicolon ( ;
).
A dcmd is denoted by one of the following words or metacharacters:
/ \ ? = > $character :character ::identifier
Dcmds named by metacharacters or prefixed by a single dollar sign ($)
or colon character (:) are provided as built-in operators. These dcmds implement complete
compatibility with the command set of the legacy adb(1) utility. After a dcmd has
been parsed, the /, \, ?, =, >, $, and : characters are
no longer recognized as metacharacters until the termination of the argument list.
A simple-command is a dcmd followed by a sequence of zero or more
blank-separated words. The words are passed as arguments to the invoked dcmd, except
as specified under Arithmetic Expansion and Quoting.
Each dcmd returns an exit status value that indicates one of the
following occurred:
A pipeline is a sequence of one or more simple-commands, each separated by
the vertical bar or pipe character (|). After the pipeline has been parsed,
each dcmd is invoked in order from left to right. Each dcmd's output
is processed and stored as described in Dcmd Pipelines. After the first dcmd in the
pipeline is complete, its processed output is used as input for the second
dcmd in the pipeline. When the second dcmd is complete, its output is
used as input for the third dcmd in the pipeline, and so
on. If any dcmd does not return a successful exit status, the pipeline
is aborted.
An expression is a sequence of words that is evaluated to compute a
64-bit unsigned integer value. The words are evaluated using the rules described in
Arithmetic Expansion.