ADB(1) — USER COMMANDS
NAME
adb − debugger
SYNOPSIS
adb [ −w ] [ −k ] [ −I dir ] [ objfil [ corfil ] ]
DESCRIPTION
adb is an interactive, general-purpose debugger. It can be used to examine files and provides a controlled environment for the execution of UNIX programs.
objfil is normally an executable program file, preferably containing a symbol table. If the file does not contain a symbol table, it can still be examined, but the symbolic features of adb cannot be used. The default for objfil is a.out. corfil is assumed to be a core image file produced after executing objfil. The default for corfil is core.
OPTIONS
−w Create both objfil and corfil if necessary and open them for reading and writing so that files can be modified using adb.
−k Do UNIX kernel memory mapping; should be used when core is a UNIX crash dump or /dev/mem.
−I specifies a directory where files to be read with $< or $<< (see below) will be sought; the default is /usr/lib/adb.
USAGE
Refer to adb in Debugging Tools for the Sun Workstation for more complete information on how to use adb. (Note: Some commands require that you compile progams to be debugged with the −go compiler flag; see cc(1V) for details.)
Commands
adb reads commands from the standard input and displays responses on the standard output. It ignores the QUIT signal. INTERRUPT invokes the next adb command. adb generally recognizes command input of the form:
[ address ] [, count ] command [ ; ]
address and count (if supplied) are expressions that result, respectively, in a new current address, and a repetition count. command is composed of a verb followed by a modifier or list of modifiers.
The symbol . represents the current location. It is initially zero. The default count is 1.
Verbs
? Print locations starting at address in objfil.
/ Print locations starting at address in corfil.
= Print the value of address itself.
@ Interpret address as a source address. Print locations in objfil or lines of source, as appropriate.
: Manage a subprocess.
$r Print names and contents of CPU registers.
$R Print names and contents of MC68881 registers, if any.
$x Print the names and contents of FPA registers 0 through 15, if any.
$X Print the names and contents of FPA registers 16 through 31, if any.
> Assign a value to a variable or register.
RETURN Repeat the previous command with a count of 1. Increment .
! Shell escape.
Modifiers
Modifiers specify the format of command output. Each modifier consists of a letter, preceded by an integer repeat count.
Format Modifiers
The following format modifiers apply to the commands ?, /, @, and =. To specify a format, follow the command with an optional repeat count, and the desired format letter or letters:
[ v ] [ [ r ] f ... ]
where v is one of these four command verbs, r is a repeat count, and f is one of the format letters listed below:
o (. increment: 2) Print 2 bytes in octal.
O (4) Print 4 bytes in octal.
q (2) Print in signed octal.
Q (4) Print long signed octal.
d (2) Print in decimal.
D (4) Print long decimal.
x (2) Print 2 bytes in hexadecimal.
X (4) Print 4 bytes in hexadecimal.
u (2) Print as an unsigned decimal number.
U (4) Print long unsigned decimal.
f (4) Print a single-precision floating-point number.
F (8) Print a double-precision floating-point number.
eE (12) Print a 96-bit MC68881 extended-precision floating-point number.
b (1) Print the addressed byte in octal.
c (1) Print the addressed character.
C (1) Print the addressed character using ^ escape convention.
s (n) Print the addressed string.
S (n) Print a string using the ^ escape convention.
Y (4) Print 4 bytes in date format.
i (n) Print as machine instructions.
z (n) Print with MC68010 machine instruction timings.
I (0) Print the source text line specified by .
a (0) Print the value of . in symbolic form.
p (4) Print the addressed value in symbolic form.
A (0) Print the value of . in source-symbol form.
P (4) Print the addressed value in source-symbolform.
t (0) Tab to the next appropriate tab stop.
r (0) Print a space.
n (0) Print a newline.
’...’ (0) Print the enclosed string.
^ (0) Decrement .
+ (0) Increment .
− (0) Decrement . by 1
Modifiers for ? and / Only
l value mask
Apply mask and compare for value; move . to matching location.
L value mask
Apply mask and compare for 4-byte value; move . to matching location.
w value Write the 2-byte value to address.
W value Write the 4-byte value to address.
m b1 e1 f1[?/]
Map new values for b1, e1, f1. If the ‘?’ or ‘/’ is followed by ∗ then the second segment (b2,e2,f2) of the address mapping is changed.
: Modifiers
bc Set breakpoint, execute c when reached
Bc Set breakpoint using source address, execute c when reached
d Delete breakpoint
D Delete breakpoint at source address
r Run objfil as a subprocess
cs The subprocess is continued with signal s
ss Single-step the subprocess with signal s
Ss Single-step the subprocess with signal s using source lines
i Add the signal specified by address to the list of signals passed directly to the subprocess
t Remove the signal specified by address from the list implicitly passed to the subprocess.
k Terminate the current subprocess, if any.
$ Modifiers
<file Read commands from the file file.
<<file Similar to <, but can be used in a file of commands without closing the file.
>file Append output to file, which is created if it does not exist.
? Print process id, the signal which stopped the subprocess, and the registers.
r Print the general registers and the instruction addressed by pc.
x If a MC68881 is present, print its registers.
b Print all breakpoints and their associated counts and commands.
c C stack backtrace.
C C stack backtracea with names and (32 bit) values of all automatic and static variables for each active function.
d Set the default radix to address and report the new value. Note that address is interpreted in the (old) current radix. Thus “q10$d” never changes the default radix.
e Print the names and values of external variables.
w Set the page width for output to address (default 80).
s Set the limit for symbol matches to address (default 255).
o All integers input are regarded as octal.
q Exit from adb.
v Print all non zero variables in octal.
m Print the address map.
f Print a list of known source filenames.
p Print a list of known procedure names.
p (Kernel debugging) Change the current kernel memory mapping to map the designated user structure to the address given by _u, (the address of the user’s proc structure).
i Show which signals are passed to the subprocess with the minimum of adb interference.
W Reopen objfil and corfile for writing, as though the −w command−line argument had been given.
Variables
Named variables are set initially by adb but are not used subsequently.
0 The last value printed.
1 The last offset part of an instruction source.
2 The previous value of variable 1.
9 The count on the last $< or $<< command.
On entry the following are set from the system header in the corfil or objfil as appropriate.
b The base address of the data segment.
B The number of an address register that points to the FPA page.
d The data segment size.
e The entry point.
F A value of ‘1’ indicates FPA disassembly.
m The ‘magic’ number (0407, 0410 or 0413).
s The stack segment size.
t The text segment size.
Expressions
. The value of dot.
+ The value of dot incremented by the current increment.
^ The value of dot decremented by the current increment.
& The last address typed. (Used to be “"”.)
integer A number. The prefixes 0o and 0O indicate octal; 0t and 0T, decimal; 0x and 0X, hexadecimal (the default).
int.frac A floating-point number.
’cccc’ ASCII value of up to 4 characters.
<name The value of name, which is either a variable name or a register name.
symbol A symbol in the symbol table. An initial _ will be prepended to symbol if needed.
_symbol An external symbol.
routine.name
The address of the variable name in the specified routine in the symbol table. If name is omitted, the address of the most recent stack frame for routine.
(exp) The value of exp.
Unary Operators
∗exp The contents of location exp in corfil.
%exp The contents of location exp in objfil (Used to be @).
−exp Integer negation.
~exp Bitwise complement.
#exp Logical negation.
^Fexp (Control−F) Translate program address to source address.
^Aexp (Control−A) Translates source address to program address.
‘name (Backquote) Translates procedure name to sourcefile address.
"file" The sourcefile address for the zero-th line of file.
Binary Operators
Binary operators are left associative and have lower precedence than unary operators.
+ Integer addition.
− Integer subtraction.
∗ Integer multiplication.
% Integer division.
& Bitwise conjunction.
| Bitwise disjunction.
# lhs rounded up to the next multiple of rhs.
FILES
a.out
core
SEE ALSO
cc(1V), dbx(1), kadb(1), ptrace(2), a.out(5), core(5)
Program Debugging Tools for the Sun Workstation
DIAGNOSTICS
adb, when there is no current command or format. Comments about inaccessible files, syntax errors, abnormal termination of commands, etc. Exit status is 0, unless last command failed or returned nonzero status.
BUGS
There doesn’t seem to be any way to clear all breakpoints.
adb uses the symbolic information in an old and now obsolete format generated by the −go flag of cc(1V); it should be changed to use the new format generated by −g.
Since no shell is invoked to interpret the arguments of the :r command, the customary wild-card and variable expansions cannot occur.
Since there is little type-checking on addresses, using a sourcefile address in an inappropriate context may lead to unexpected results.
Sun Release 3.5 — Last change: 27 February 1986