The adb debug program uses addresses, expressions, operators, subcommands, and variables to organize and manipulate data.
The address in a file associated with a written address is determined by a mapping associated with that file. Each mapping is represented by two triples (B1, E1, F1) and (B2, E2, F2). The FileAddress parameter that corresponds to a written Address parameter is calculated as follows:
B1<=Address<E1=>FileAddress=Address+F1-B1
OR
B2<=Address<E2=>FileAddress=Address+F2-B2
If the requested Address parameter is neither between B1 and E1 nor between B2 and E2, the Address parameter is not valid. In some cases, such as programs with separated I and D space, the two segments for a file may overlap. If a ? (question mark) or / (slash) subcommand is followed by an * (asterisk), only the second triple is used.
The initial setting of both mappings is suitable for normal a.out and core files. If either file is not of the kind expected, the B1 parameter for that file is set to a value of 0, the E1 parameter is set to the maximum file size, and the F1 parameter is set to a value of 0. In this way, the whole file can be examined with no address translation.
The following expressions are supported by the adb debug program:
. (period) | Specifies the last address used by a subcommand. The last address is also known as the current address. |
+ (plus) | Increases the value of . (period) by the current increment. |
^ (caret) | Decreases the value of . (period) by the current increment. |
" (double quotes) | Specifies the last address typed by a command. |
Integer | Specifies an octal number if this parameter begins with 0o, a hexadecimal number if preceded by 0x or #, or a decimal number if preceded by 0t. Otherwise, this expression specifies a number interpreted in the current radix. Initially, the radix is 16. |
`Cccc' | Specifies the ASCII value of up to 4 characters. A \ (backslash) can be used to escape an ' (apostrophe). |
< Name | Reads the current value of the Name parameter. The Name parameter is either a variable name or a register name. The adb command maintains a number of variables named by single letters or digits. If the Name parameter is a register name, the value of the register is obtained from the system header in the CoreFile parameter. Use the $r subcommand to see the valid register names. |
Symbol | Specifies a sequence of uppercase or lowercase letters, underscores, or digits, though the sequence cannot start with a digit. The value of the Symbol parameter is taken from the symbol table in the ObjectFile parameter. An initial _ (underscore) is prefixed to the Symbol parameter, if needed. |
.Symbol | Specifies the entry point of the function named by the Symbol parameter. |
Routine.Name | Specifies the address of the Name parameter in the specified C language routine. Both the Routine and Name parameters are Symbol parameters. If the Name parameter is omitted, the value is the address of the most recently activated C stack frame corresponding to the Routine parameter. |
(Expression) | Specifies the value of the expression. |
Integers, symbols, variables, and register names can be combined with the following operators:
Binary operators are left-associative and are less binding than unary operators.
You can display the contents of a text or data segment with the ? (question mark) or the / (slash) subcommand. The = (equal sign) subcommand displays a given address in the specified format. The ? and / subcommands can be followed by an * (asterisk).
The Format parameter consists of one or more characters that specify print style. Each format character may be preceded by a decimal integer that is a repeat count for the format character. While stepping through a format, the . (period) increments by the amount given for each format letter. If no format is given, the last format is used.
The available format letters are as follows:
The adb command provides a number of variables. When the adb program is started, the following variables are set from the system header in the specified core file. If the CoreFile parameter does not appear to be a core file, these values are set from the ObjectFile parameter: