adb, adb64 - absolute debugger
adb [-w] [-Idir] [-k] [-m] [-Ppid] objfil [corfil]
adb64 [-w] [-Idir] [-k] [-m] [-Ppid] objfil [corfil]
The adb command executes a general-purpose debugging program that is
sensitive to the underlying architecture of the processor and
operating system on which it runs. It can be used to examine files
and provide a controlled environment for executing HP-UX programs.
adb calls adb64 to process 64 bit files.
objfil is normally an executable program file, or an HP-UX kernel
(vmunix), preferably containing a symbol table; if not, the symbolic
features of adb cannot be used, although the file can still be
examined. The default for objfil is a.out.
corfil is assumed to be a core image file produced after executing
objfil or an HP-UX crash file produced from the objfil. The default
for corfil is core.
Requests to adb are read from standard input and adb responds on
standard output. If the -w flag is present, objfil is created (if
necessary) and opened for reading and writing, to be modified using
adb. The -I option specifies a directory where files read with $<<<< or
$<<<<<<<< (see below) are sought; the default is /usr/lib/adb. adb ignores
QUIT; INTERRUPT causes return to the next adb command.
The following options are also supported:
-k Allows adb to read objfil as an HP-UX kernel file and corfil
as an HP-UX crash dump. This also allows virtual-to-
physical address translation, useful for kernel debugging.
In this case, corfil should be an HP-UX crash dump or
/dev/mem. Without -k or -m, adb treats objfil as an
application program file and corfil as an application core
When adb is invoked with this option, it sets up the context
of the currently running process using space registers four
through seven. A user specified address is dereferenced by
combining it with the appropriate space register, depending
on the quadrant in which the 32-bit address lies.
When the current radix is not (decimal) ten, the -k option
allows adb to support the notion of long pointers or
addresses in the form space.offset. Once a space is
Hewlett-Packard Company - 1 - HP-UX Release 11i: November 2000
specified, all subsequent addresses are dereferenced using
that space until the user enters another long address. If a
space equal to (hexadecimal) 0xffffffff is used, adb reverts
to the previous context and uses space registers four
through seven to dereference 32-bit addresses.
-m Must be specified instead of -k when a core dump is written
to multiple files.
When -m is used, corfil must be specified as the path name
of the directory that contains system core dump files. A
command line using -m might look similar to the following:
adb -m /var/adm/crash/core.1/vmunix /var/adm/crash/core.1
Notice that when -m is specified on the command line, -k is
-Ppid Causes adb to adopt process pid as a "traced" process (see
ptrace(2)). This option is helpful for debugging processes
that were not originally run under the control of adb.
Requests to adb follow the form:
[address] [, count] [command] [;]
If address is present, dot is set to address. Initially dot is set to
0. For most commands, count specifies the number of times the command
is to be executed. The default count is 1. address and count are
The interpretation of an address depends on the context in which it is
used. If a subprocess is being debugged, addresses are interpreted in
the address space of the subprocess. (For further details of address
mapping see Addresses below.)
Expressions are interpreted as follows:
. The value of dot.
+ The value of dot increased by the current increment.
^ The value of dot decreased by the current decrement.
" The last address typed.
integer A number. The prefix 0 (zero) forces interpretation
in octal radix; the prefixes 0d and 0D force
interpretation in decimal radix; the prefixes 0x and
0X force interpretation in hexadecimal radix. Thus
Hewlett-Packard Company - 2 - HP-UX Release 11i: November 2000
020 = 0d16 = 0x10 = sixteen. If no prefix appears,
the default radix is used; see the $d command. The
radix is initialized to the base used in the assembly
language for the processor involved. Note that a
hexadecimal number whose most significant digit would
otherwise be an alphabetic character must have a 0x
(or 0X) prefix.
A 32-bit floating-point number.
'cccc' The ASCII value of up to 4 characters. A backslash
(\) can be used to escape a single quote (').
<<<< name name can have the value of either a variable or a
register. adb maintains a number of variables named
by single letters or digits; see Variables below. If
name is a register, the value of the register is
obtained from the CORE_PROC segment in corfil (before
the subprocess is initiated) or from the user area of
the subprocess. Register names are implementation
dependent; see the $r command.
symbol A symbol is a sequence of uppercase or lowercase
letters, underscores, or digits, not starting with a
digit. A backslash (\) can be used to escape other
characters. The value of the symbol is taken from
the symbol table in objfil. An initial underscore
(_) is prefixed to symbol, if needed.
_ symbol If the compiler prefixes _ to an external symbol, it
may be necessary to cite this name to distinguish it
from a symbol generated in assembly language.
(exp) The value of the expression exp.
The following are monadic operators:
*exp The contents of the location addressed by exp in
@ exp The contents of the location addressed by exp in
-exp Integer negation.
~exp Bitwise complement.
The following dyadic operators are left associative and are less
binding than monadic operators:
Hewlett-Packard Company - 3 - HP-UX Release 11i: November 2000
e1+e2 Integer addition.
e1-e2 Integer subtraction.
e1*e2 Integer multiplication.
e1%e2 Integer division.
e1&&&&e2 Bitwise conjunction.
e1|e2 Bitwise disjunction.
e1#e2 e1 rounded up to the next multiple of e2.
Most commands consist of an action character followed by a modifier or
list of modifiers. The following action characters can take format
specifiers. (The action characters ? and / can be followed by *; see
Addresses for further details.)
?f Locations starting at address in objfil are printed
according to the format f. dot is incremented by the
sum of the increments for each format letter. If a
subprocess has been initiated, address references a
location in the address space of the subprocess
instead of objfil.
/f Locations starting at address in corfil are printed
according to the format f and dot is increased like
?. If a subprocess has been initiated, address
refers to a location in the address space of the
subprocess instead of corfil.
=f The value of address is printed in the styles
indicated by the format f. (For i format ? is
printed for the parts of the instruction that refer
to subsequent words.)
A format consists of one or more characters that specify a style of
printing. Each format character can be preceded by an integer that
indicates how many times the format is repeated. While stepping
through a format, dot is increased by the amount given for each format
character. If no format is given then the last format is used.
The following format characters are available:
a 0 Print the value of dot in symbolic form.
b 1 Print the addressed byte in hexadecimal.
Hewlett-Packard Company - 4 - HP-UX Release 11i: November 2000
B 1 Print the addressed byte in octal.
c 1 Print the addressed character (the sign bit is
C 1 Print the addressed character using the following
escape convention. First, the sign bit is discarded,
then character values 000 to 040 are printed as @
followed by the corresponding character in the range
0100 to 0140. The character @ is printed as @@.
d 2 Print 2 bytes in decimal.
D 4 Print 4 bytes in decimal.
f 4 Print the 32 bit value as a floating point number.
F 8 Print double floating point.
i n Print as machine instructions. The value of n is the
number of bytes occupied by the instruction.
n 0 Print a new-line character.
o 2 Print 2 bytes in octal. All octal numbers output by
adb are preceded by 0.
O 4 Print 4 bytes in octal.
p n Print the addressed value in symbolic form. The
value of n is a machine-dependent constant.
q 2 Print 2 bytes in signed octal.
Q 4 Print 4 bytes in signed octal.
r 0 Print a space.
s n Print the addressed characters until a zero character
S n Print a string using the @ escape convention. The
value n is the length of the string including its
t 0 When preceded by an integer, moves to the next
appropriate tab stop. For example, 8t moves to the
next 8-space tab stop.
u 2 Print 2 bytes as an unsigned decimal number.
Hewlett-Packard Company - 5 - HP-UX Release 11i: November 2000
U 4 Print 4 bytes as an unsigned decimal number.
x 2 Print 2 bytes in hexadecimal.
X 4 Print 4 bytes in hexadecimal.
Y 4 Print 4 bytes in date format (see ctime(3C)).
"..." 0 Print the enclosed string.
^ dot is decreased by the current increment. Nothing
+ dot is increased by 1. Nothing is printed.
- dot is decreased by 1. Nothing is printed.
Repeat the previous command with a count of 1. The value of
dot continues from the end of the previous format, unlike a
[?/] command with no address, which repeats the previous
address value. New-line can also be used to repeat a :s or
:c command; however, any arguments to the previous command
[?/]l value mask
Words starting at dot are masked with mask and compared with
value until a match is found. If L is used, adb looks to
match 4 bytes at a time instead of 2. If no match is found,
dot is left unchanged; otherwise dot is set to the matched
location. If mask is omitted -1 is used.
[?/]w value ...
Write the 2-byte value into the addressed location. If the
command is W, write 4 bytes. Odd addresses are not allowed
when writing to the subprocess address space.
=m Toggle the address mapping of corfil between the initial map
set up for a valid core file and the default mapping pair
which the user can modify with /m. If the corfil was
invalid, only the default mapping is available.
[?/]m b1 e1 f1[?/]
Record new values for (b1, e1, f1). If fewer than three
expressions are given, the remaining map parameters are left
unchanged. If the ? or / is followed by *, the second
segment (b2, e2, f2) of the mapping is changed. If the list
is terminated by ? or /, the file (objfil or corfil,
respectively) is used for subsequent requests. (For
example, /m? causes / to refer to objfil.) A /m command
switches the corfil mapping to the default mapping pair.
Hewlett-Packard Company - 6 - HP-UX Release 11i: November 2000
For a valid core file, the =m command can be used to switch
back to the initial mapping.
Assign dot to the variable or register named.
! Call a shell to read the remainder of the line following !.
The following $ commands take the form $modifier:
$<<<<f Read commands from the file f. If this command is
executed in a file, further commands in the file are
not seen. If a count is given, and is zero, the
command is ignored. The value of the count is placed
in variable 9 before the first command in f is
$<<<<<<<<f Similar to $<<<< except it can be used in a file of
commands without causing the file to be closed.
Variable 9 is saved when the command executes and is
restored when it completes. Only five $<<<<<<<< files can
be open at once.
$>>>>f Send output to the file f, which is created if it
does not already exist.
$new-line Print the process id and register values.
$b Print all breakpoints and their associated counts and
$c C stack backtrace. If address is given, it is taken
as the address of the current frame (instead of the
normal stack frame pointer). If count is given, only
the first count frames are printed.
$d Set the default radix to address and report the new
value. Note that address is interpreted in the (old)
current radix. Thus 10$d never changes the default
radix. To make decimal the default radix, use
$e The names and values of external variables are
$f Print the floating-point registers.
$m Print the address map. This includes both the
initial and default maps for a valid corfil with an
indication of which is currently active.
Hewlett-Packard Company - 7 - HP-UX Release 11i: November 2000
Print the number of nodes on V-class multinode
machines and the current node number. To switch to
another node, enter $N nodenumber.
$o The default for all integers input is octal.
$q Exit from adb.
$r Print the general registers and the instruction
addressed by the process counter. dot is set to the
process counter contents.
$s Set the limit for symbol matches to address. The
default is system dependent.
$v Print all non-zero variables in the current radix.
$w Set the page width for output to address (default
$x The default for all integers input is hexadecimal.
$z Print a list of signals and how they are handled. See
:z for information on changing signal handling.
The available : commands manage subprocesses, and take the form
:bc Set breakpoint at address. The breakpoint is
executed count-1 times before causing a stop. Each
time the breakpoint is encountered, the command c is
executed. If this command sets dot to zero, the
breakpoint causes a stop.
:cs Continue the subprocess with signal s (see
signal(5)). If address is given, the subprocess
continues at this address. If no signal is
specified, the signal that caused the subprocess to
stop is sent. Breakpoint skipping is the same as for
:d Delete breakpoint at address. :d* deletes all
:e Set up a subprocess as in :r; no instructions are
:k Terminate the current subprocess, if any.
Hewlett-Packard Company - 8 - HP-UX Release 11i: November 2000
:r Run objfil as a subprocess. If address is given
explicitly, the program is entered at this point;
otherwise the program is entered at its standard
entry point. The value count specifies how many
breakpoints are ignored before stopping. Arguments
to the subprocess may be supplied on the same line as
the command. An argument starting with <<<< or >>>> causes
the standard input or output to be established for
the command. All signals are turned on when entering
:ss As for c except that the subprocess is single stepped
count times. If there is no current subprocess,
objfil is run as a subprocess as for :r. In this
case no signal can be sent; the remainder of the line
is treated as arguments to the subprocess.
:Ss Same as :c except that a temporary breakpoint is set
at the next instruction. Useful for stepping across
:x a [b]... Execute subroutine a with parameters [b]...
:zd Change signal handling for a specified signal.
Disposition d can be specified as:
+s Stop process when signal is received.
-s Do not stop process when signal is
+r Report when signal is received.
-r Do not report when signal is received.
+d Deliver signal to the target process.
-d Do not deliver signal to the target
For example, 0x10:z+d enables delivering of signal
number 0x10 to the target process. Use $z to display
adb provides named and numbered variables. Named variables are set
initially by adb but are not used subsequently. Numbered variables
are reserved for communication as follows:
0 The last value printed.
Hewlett-Packard Company - 9 - HP-UX Release 11i: November 2000
1 The last offset part of an instruction source.
2 The previous value of variable 1.
9 The count on the last $<<<< command.
On entry, the following named variables are set from the coreheaders
in the corfil. If corfil does not appear to be a core file, these
values are set from objfil.
b The base address of the data segment.
d The data segment size.
s The stack segment size.
t The text segment size.
The following variables are set from objfil.
e The entry point.
m The "magic" number as defined in <<<<magic.h>>>>.
The file address associated with a written address is determined by a
mapping described below; see $m. Both the objfil mapping and the
default corfil mapping are represented by two triples (b1, e1, f1) and
(b2, e2, f2). The initial mapping for a valid corfil contains a
triple for each segment (coreheader).
The file address corresponding to a written address is calculated as
b1 <= address < e1, then file address = address + f1 - b1.
b2 <= address < e2, then file address = address + f2 - b2.
Otherwise, the requested address is not valid. For a valid corfil,
this pattern repeats as many times as there are segments (coreheaders)
in the corfil, rather than twice. If ? or / is followed by *, only
the second triple is used, or (when using the initial mapping of a
valid corfil) only segments with a CORE_STACK coreheader.
The initial setting of both mappings is suitable for normal a.out and
core files. If either file is not of the kind expected, adb sets b1
to 0, e1 to the maximum file size, and f1 to 0; in this way the entire
Hewlett-Packard Company - 10 - HP-UX Release 11i: November 2000
file can be examined with no address translation.
adb keeps all appropriate values as signed 32-bit integers so that it
can be used on large files.
International Code Set Support
Single- and multi-byte character code sets are supported.
adb comments about inaccessible files, syntax errors, abnormal
termination of commands, etc. It echoes adb when there is no current
command or format. Exit status is 0, unless the last command failed
or returned non-zero status.
+ Setting breakpoints in shared libraries is not supported.
adb does not read the linker symbol table for shared libraries, and
cannot access locations in shared libraries by name. In a stack
backtrace ($c), adb does not know the names of shared library
If the core file was created when the program was in a shared
library function, the $c command does not work. When a stack
backtrace for the core file encounters a shared library procedure
on the stack it aborts at that point.
+ A leading zero by itself is not recognized as a radix indicator.
Use the prefixes 0o or 0O (zero-oh) to force interpretation in
octal radix. The prefixes 0t and 0T are also accepted to force
interpretation in decimal radix. Thus 0o20 = 0t16 = sixteen. A
hexadecimal number whose most significant digit would otherwise be
an alphabetic character may begin with a leading zero instead of 0x
(or 0X), if the default radix is hexadecimal.
+ The $f command prints floating point registers as 32-bit single
precision and $F prints these registers as 64-bit doubles.
+ $R prints all registers available to adb users.
+ The :x and :S commands are not currently supported.
+ adb can be used to inspect relocatable object files; it reads the
symbol table and sets up the appropriate mappings for text and
data. Note that relocatable object files do not necessarily
contain an exact image of the initialized data; however, if this is
the case, the data mapping is not set.
adb was developed by AT&T and HP.
Hewlett-Packard Company - 11 - HP-UX Release 11i: November 2000
ptrace(2), crt0(3), ctime(3C), end(3C), a.out(4), core(4), signal(5).
Hewlett-Packard Company - 12 - HP-UX Release 11i: November 2000