2.  A Quick Survey

2.1.  Invocation

      ADB is invoked as:
adb objfile corefile
where objfile is an executable UNIX file and corefile is a core image file. Many times this will look like:
adb a.out core
or more simply:
adb
where the defaults are a.out and core respectively. The filename minus (-) means ignore this argument as in:
adb - core

      ADB has requests for examining locations in either file. The ? request examines the contents of objfile, the / request examines the corefile. The general form of these requests is:
address ? format
or
address / format

2.2.  Current Address

      ADB maintains a current address, called dot, similar in function to the current pointer in the UNIX editor. When an address is entered, the current address is set to that location, so that:
0126?i
sets dot to octal 126 and prints the instruction at that address. The request:
.,10/d
prints 10 decimal numbers starting at dot. Dot ends up referring to the address of the last item printed. When used with the ? or / requests, the current address can be advanced by typing newline; it can be decremented by typing ^.

      Addresses are represented by expressions. Expressions are made up from decimal, octal, and hexadecimal integers, and symbols from the program under test. These may be combined with the operators +, -, *, % (integer division), & (bitwise and), | (bitwise inclusive or), # (round up to the next multiple), and ~ (not). (All arithmetic within ADB is 32 bits.) When typing a symbolic address for a C program, the user can type name or _name; ADB will recognize both forms.

2.3.  Formats

      To print data, a user specifies a collection of letters and characters that describe the format of the printout. Formats are "remembered" in the sense that typing a request without one will cause the new printout to appear in the previous format. The following are the most commonly used format letters.
b one byte in octal
c one byte as a character
o one word in octal
d one word in decimal
f two words in floating point
i PDP 11 instruction
s a null terminated character string
a the value of dot
u one word as unsigned integer
n print a newline
r print a blank space
^ backup dot
(Format letters are also available for "long" values, for example, `D' for long decimal, and `F' for double floating point.) For other formats see the ADB manual.

2.4.  General Request Meanings

      The general form of a request is:
address,count command modifier
which sets `dot' to address and executes the command count times.

      The following table illustrates some general ADB command meanings:
Command Meaning
? Print contents from a.out file
/ Print contents from core file
= Print value of "dot"
: Breakpoint control
$ Miscellaneous requests
; Request separator
! Escape to shell

      ADB catches signals, so a user cannot use a quit signal to exit from ADB. The request $q or $Q (or cntl-D) must be used to exit from ADB.