Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ adb(1) — HP-UX 6.00

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

ptrace(2)

a.out(4)

core(4)

ADB(1)  —  HP-UX

Series 300, 800 Only

NAME

adb − absolute debugger

SYNOPSIS

adb [ −w ] [ −Idir ] [ objfil [ corfil ] ]

DESCRIPTION

Adb is a general-purpose debugging program sensitive to the underlying architecture of the processor on which it runs.  It can be used to examine files and provide a controlled environment for the execution of HP-UX programs. 

Objfil is normally an executable program file, 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; the default for corfil is core. 

Requests to adb are read from standard input and adb responds to 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. 

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 will be executed.  The default count is 1.  Address and count are expressions. 

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

.  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 prefixes 0o and 0O (“zero oh”) force interpretation in octal radix; the prefixes 0t,0T,0d and 0D force interpretation in decimal radix; the prefixes 0x and 0X force interpretation in hexadecimal radix.  Thus 0o20 = 0t16 = 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 (or a leading zero if the default radix is hexadecimal). 

integer.fraction 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 system header 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.    The value of the symbol is taken from the symbol table in objfil. An initial _ will be 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 corfil.

@ exp The contents of the location addressed by exp in objfil.

−exp Integer negation. 

~exp Bitwise complement. 

The following dyadic operators are left associative and are less binding than monadic operators:

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.

Commands

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:

o  2 Print 2 bytes in octal.  All octal numbers output by adb are preceded by 0. 

O  4 Print 4 bytes in octal. 

q  2 Print 2 bytes in signed octal. 

Q  4 Print 4 bytes in signed octal. 

d  2 Print 2 bytes in decimal. 

D  4 Print 4 bytes in decimal. 

x  2 Print 2 bytes in hexadecimal. 

X  4 Print 4 bytes in hexadecimal. 

u  2 Print 2 bytes as an unsigned decimal number. 

U  4 Print 4 bytes as an unsigned decimal number. 

f  4 Print the 32 bit value as a floating point number. 

F  8 Print double floating point. 

b  1 Print the addressed byte in hexadecimal. 

B  1 Print the addressed byte in octal. 

c  1 Print the addressed character. (The sign bit is ignored.) 

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 @@. 

s  n Print the addressed characters until a zero character is reached. 

S  n Print a string using the @ escape convention.  The value n is the length of the string including its zero terminator. 

Y  4 Print 4 bytes in date format (see ctime(3C)).

i  n Print as machine instructions.  The value of n is the number of bytes occupied by the instruction. 

a  0 Print the value of dot in symbolic form. 

p  n Print the addressed value in symbolic form.  The value of n is a machine dependent constant. 

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. 

r  0 Print a space. 

n  0 Print a new-line. 

“...”  0 Print the enclosed string. 

^ Dot is decreased by the current increment.  Nothing is printed. 

+ Dot is increased by 1.  Nothing is printed. 

− Dot is decreased by 1.  Nothing is printed. 

new-line Repeat the previous command with a count of 1.  New-line can also be used to repeat a :s or :c command; however, any arguments to the previous command are lost. 

[?/]l value mask Words starting at dot are masked with mask and compared with value until a match is found.  If L is used, then 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 b1 e1 f1[?/]
Record new values for (b1, e1, f1). If less 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? will cause / to refer to objfil.) 

name 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 will be ignored.  The value of the count will be placed in variable 9 before the first command in f is executed. 

$<<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.

$r Print the general registers and the instruction addressed by the process counter.  Dot is set to the process counter contents. 

$f Print the floating-point registers. 

$b Print all breakpoints and their associated counts and commands. 

$c C stack backtrace.  If address is given then it is taken as the address of the current frame (instead of the normal stack frame pointer).  If count is given then only the first count frames are printed. 

$e The names and values of external variables are printed. 

$w Set the page width for output to address (default 80). 

$s Set the limit for symbol matches to address. The default is system dependent. 

$o The default for all integers input is octal. 

$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 0t10$d. 

$x The default for all integers input is hexadecimal. 

$q Exit from adb.

$v Print all non-zero variables in the current radix. 

$m Print the address map. 

$new-line print the process id and register values. 

The available : commands manage subprocesses, and take the form :modifier:

: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. 

:d Delete breakpoint at address. :d∗ will delete all breakpoints. 

: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 the subprocess. 

:e Set up a subprocess as in :r; no instructions are executed. 

:cs Continue he subprocess with signal s (see signal(2)). 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 :r. 

:ss As for c except that the subprocess is single stepped count times.  If there is no current subprocess then 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
As for :c except that a temporary breakpoint is set at the next instruction.  Useful for stepping across subroutines. 

:x a [b]...  Execute subroutine a with parameters [b]...

:k Terminate the current subprocess, if any. 

Variables

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. 

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 system header 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. 

e The entry point. 

m The “magic” number as defined in <magic.h>. 

s The stack segment size. 

t The text segment size. 

Addresses

The file address associated with a written address is determined by a mapping described below; see $m.  Each mapping is represented by two triples (b1, e1, f1) and (b2, e2, f2). The file address corresponding to a written address is calculated as follows:

If

b1 ≤ address < e1, file address = address + f1−b1,

otherwise, if

b2 ≤ address < e2, file address = address + f2−b2,

otherwise, the requested address is not valid.  In some cases (for example, for programs with separated I and D space) the two segments for a file may overlap.  If ?  or / is followed by ∗, 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, adb sets to b1 0, e1 t to the maximum file size, and f1 to 0; in this way the entire 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. 

RETURN VALUE

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. 

DEPENDENCIES

Series 300
The -I option is not currently supported. 

The I format prints machine instructions, like i, except that immediate constants are printed in decimal. 

The command $n is provided to set the number of significant digits for floating-point dumps to address. 

Variable 9 is not updated for the $< command, and the $<< command is not supported. 

The following variables are also supported:

f If this is set to a non-zero value, any sequence of machine instructions which effectively constitute a single floating point accelerator instruction will be treated as a single instruction for machine level single-stepping and display. 

r If f is set to a non-zero value, r indicates which address register is used in floating point accelerator instruction sequences.  A 0 corresponds to register a0, 1 to a1, etc.  The default value is 2. 

Series 800
The $f command will print floating point registers as 32-bit single precision and $F will print these registers as 64-bit doubles. 

$R will print all registers available to adb users. 

The :x and :S commands are not currently supported. 

The following options are also supported:

−k Allows virtual-to-physical address translation, useful for kernel debugging.  In this case, core should be an HP-UX crash dump or /dev/mem. 

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.  The $p command is provided to change the current context.  The address argument is the address of the process structure corresponding to the desired context. 

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 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. 

−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.

AUTHOR

Adb was developed by AT&T and HP. 

FILES

a.out
core
/dev/mem
/dev/swap

SEE ALSO

ptrace(2), a.out(4), core(4). 

INTERNATIONAL SUPPORT

8- and 16-bit data, 8-bit file names. 

Hewlett-Packard Company  —  Version B.1,  May 11, 2021

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026