Difference between revisions of "32v 1m adb"

From Computer History Wiki
Jump to: navigation, search
(New page: ADB(1) UNIX Programmer's ManualADB(1) == NAME == adb - debugger == SYNOPSIS == adb [-w] [ objfil [ corfil ] ] == DESCRIPTION == '''Adb''' is a general purpose debugging program. I...)
 
m (SEE ALSO)
 
(2 intermediate revisions by the same user not shown)
Line 30: Line 30:
 
In general requests to '''adb''' are of the form
 
In general requests to '''adb''' are of the form
  
['''address''']  [,'''count'''] ['''command'''] [;]
+
['''address''']  [,'''count'''] ['''command'''] [;]
  
 
If '''address''' is present then '''dot''' is set to '''address'''.  Initially
 
If '''address''' is present then '''dot''' is set to '''address'''.  Initially
Line 44: Line 44:
  
 
== EXPRESSIONS ==
 
== EXPRESSIONS ==
. The value of _d_o_t.
+
. The value of '''dot'''.
  
+ The value of _d_o_t incremented by the current incre-
+
+ The value of '''dot''' incremented by the current increment.
  ment.
 
  
^ The value of _d_o_t decremented by the current incre-
+
^ The value of '''dot''' decremented by the current increment.
  ment.
 
  
" The last _a_d_d_r_e_s_s typed.
+
" The last '''address''' typed.
  
 
'''integer'''
 
'''integer'''
  
A number.  The prefixes 0o and 0O (``zero oh'') force
+
A number.  The prefixes 0o and 0O (``zero oh'') force interpretation in octal radix; the prefixes 0t and 0T force interpretation in decimal radix; the prefixes 0x and 0X force interpretation in hexadecimal radix. Thus 0o20 = 0t16 = 0x10 = sixteen.  If no prefix appears, then the '''default radix''' is used; see the $d command.  The default radix is initially hexadecimal. The hexadecimal digits are 0123456789abcdefABCDEF with the obvious values.  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).
interpretation in octal radix; the prefixes 0t and 0T
 
force interpretation in decimal radix; the prefixes
 
0x and 0X force interpretation in hexadecimal radix.
 
Thus 0o20 = 0t16 = 0x10 = sixteen.  If no prefix
 
appears, then the '''default radix''' is used; see the $d
 
command.  The default radix is initially hexadecimal.
 
The hexadecimal digits are 0123456789abcdefABCDEF
 
with the obvious values.  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).
 
  
_i_n_t_e_g_e_r._f_r_a_c_t_i_o_n
+
'''integer.fraction'''
  A 32 bit floating point number.
+
A 32 bit floating point number.
  
'_c_c_c_c' The ASCII value of up to 4 characters.  \ may be used
+
'cccc' The ASCII value of up to 4 characters.  \ may be used to escape a '.
  to escape a '.
 
  
< _n_a_m_e The value of _n_a_m_e, which is either a variable name or
+
< '''name''' The value of '''name''', which is either a variable name or a register name.  _A_d_b maintains a number of variables (see VARIABLES) named by single letters or digits. If '''name''' is a register name then the value of the register is obtained from the system header in '''corfil'''.  The register names are those printed by the $r command.
  a register name.  _A_d_b maintains a number of variables
 
  (see VARIABLES) named by single letters or digits.
 
  If _n_a_m_e is a register name then the value of the
 
  register is obtained from the system header in _c_o_r_-
 
  _f_i_l.  The register names are those printed by the $r
 
  command.
 
  
_s_y_m_b_o_l A _s_y_m_b_o_l is a sequence of upper or lower case
+
'''symbol''' A '''symbol''' is a sequence of upper or lower case letters, underscores or digits, not starting with a digit.  The value of the '''symbol''' is taken from the symbol table in '''objfil'''.  An initial _ or ~ will be prepended to '''symbol''' if needed.
  letters, underscores or digits, not starting with a
 
  digit.  The value of the _s_y_m_b_o_l is taken from the
 
  symbol table in _o_b_j_f_i_l.  An initial _ or ~ will be
 
  prepended to _s_y_m_b_o_l if needed.
 
  
_ _s_y_m_b_o_l
+
'''_symbol'''
  In C, the `true name' of an external symbol begins
+
In C, the `true name' of an external symbol begins with _.  It may be necessary to utter this name to disinguish it from internal or hidden variables of a program.
  with _.  It may be necessary to utter this name to
 
  disinguish it from internal or hidden variables of a
 
  program.
 
  
_r_o_u_t_i_n_e._n_a_m_e
+
'''routine.name'''
  The address of the variable _n_a_m_e in the specified C
+
The address of the variable '''name''' in the specified C routine.  Both '''routine''' and '''name''' are '''symbols'''.  If '''name''' is omitted the value is the address of the most recently activated C stack frame corresponding to '''routine'''.
  routine.  Both _r_o_u_t_i_n_e and _n_a_m_e are _s_y_m_b_o_l_s.  If _n_a_m_e
 
  is omitted the value is the address of the most
 
  recently activated C stack frame corresponding to
 
  _r_o_u_t_i_n_e.
 
  
(_e_x_p)  The value of the expression _e_x_p.
+
('''exp''')  The value of the expression '''exp'''.
  
 
Monadic operators
 
Monadic operators
  
*_e_x_p   The contents of the location addressed by _e_x_p in
+
'''*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.
  
Printed 11/26/79  UNIX/32V   2
+
'''~exp'''   Bitwise complement.
  
 +
Dyadic operators are left associative and are less binding than monadic operators.
  
 +
'''e1'''+'''e2'''  Integer addition.
  
 
+
'''e1'''-'''e2''' Integer subtraction.
 
 
 
 
ADB(1)    UNIX Programmer's ManualADB(1)
 
 
 
 
 
 
 
  _c_o_r_f_i_l.
 
 
 
@_e_x_p  The contents of the location addressed by _e_x_p in
 
  _o_b_j_f_i_l.
 
 
 
-_e_x_p  Integer negation.
 
 
 
~_e_x_p  Bitwise complement.
 
 
 
Dyadic operators are left associative and are less binding
 
than monadic operators.
 
 
 
_e_1+_e_2  Integer addition.
 
 
 
_e_1-_e_2 Integer subtraction.
 
  
 
_e_1*_e_2  Integer multiplication.
 
_e_1*_e_2  Integer multiplication.
Line 148: Line 99:
 
_e_1#_e_2  _E_1 rounded up to the next multiple of _e_2.
 
_e_1#_e_2  _E_1 rounded up to the next multiple of _e_2.
  
COMMANDS
+
== COMMANDS ==
 
Most commands consist of a verb followed by a modifier or
 
Most commands consist of a verb followed by a modifier or
 
list of modifiers.  The following verbs are available.  (The
 
list of modifiers.  The following verbs are available.  (The
Line 174: Line 125:
 
format is given then the last format is used.  The format
 
format is given then the last format is used.  The format
 
letters available are as follows.
 
letters available are as follows.
 
 
 
Printed 11/26/79  UNIX/32V  3
 
 
 
 
 
 
 
ADB(1)    UNIX Programmer's ManualADB(1)
 
 
 
  
 
o 2  Print 2 bytes in octal.  All octal numbers output
 
o 2  Print 2 bytes in octal.  All octal numbers output
Line 225: Line 163:
 
ate type as indicated below.
 
ate type as indicated below.
  
  /  local or global data symbol
+
/  local or global data symbol
  ?  local or global text symbol
+
?  local or global text symbol
  =  local or global absolute symbol
+
=  local or global absolute symbol
  
 
p 2  Print the addressed value in symbolic form using
 
p 2  Print the addressed value in symbolic form using
Line 238: Line 176:
 
"..." 0
 
"..." 0
 
Print the enclosed string.
 
Print the enclosed string.
^    _D_o_t is decremented by the current increment.
+
^    _D_o_t is decremented by the current increment. Nothing is printed.
Nothing is printed.
 
 
 
 
 
 
 
Printed 11/26/79  UNIX/32V  4
 
 
 
 
 
 
 
 
 
 
 
 
 
ADB(1)    UNIX Programmer's ManualADB(1)
 
 
 
 
 
 
 
 
+    _D_o_t is incremented by 1.  Nothing is printed.
 
+    _D_o_t is incremented by 1.  Nothing is printed.
 
-    _D_o_t is decremented by 1.  Nothing is printed.
 
-    _D_o_t is decremented by 1.  Nothing is printed.
Line 306: Line 229:
 
taken as the address of the current frame (instead
 
taken as the address of the current frame (instead
 
of r5).  If C is used then the names and (16 bit)
 
of r5).  If C is used then the names and (16 bit)
 
 
 
Printed 11/26/79  UNIX/32V  5
 
 
 
 
 
 
 
ADB(1)    UNIX Programmer's ManualADB(1)
 
 
 
 
 
values of all automatic and static variables are
 
values of all automatic and static variables are
 
printed for each active function.  If _c_o_u_n_t is
 
printed for each active function.  If _c_o_u_n_t is
Line 372: Line 281:
 
s_s  As for c except that the subprocess is single
 
s_s  As for c except that the subprocess is single
 
stepped _c_o_u_n_t times.  If there is no current
 
stepped _c_o_u_n_t times.  If there is no current
 
 
 
Printed 11/26/79  UNIX/32V  6
 
 
 
 
 
 
 
ADB(1)    UNIX Programmer's ManualADB(1)
 
 
 
 
 
subprocess then _o_b_j_f_i_l is run as a subprocess as
 
subprocess then _o_b_j_f_i_l is run as a subprocess as
 
for r.  In this case no signal can be sent; the
 
for r.  In this case no signal can be sent; the
Line 393: Line 288:
 
k    The current subprocess, if any, is terminated.
 
k    The current subprocess, if any, is terminated.
  
VARIABLES
+
== VARIABLES ==
 
_A_d_b provides a number of variables.  Named variables are set
 
_A_d_b provides a number of variables.  Named variables are set
 
initially by _a_d_b but are not used subsequently.  Numbered
 
initially by _a_d_b but are not used subsequently.  Numbered
Line 435: Line 330:
 
whole file can be examined with no address translation.
 
whole file can be examined with no address translation.
  
So that _a_d_b may be used on large files all appropriate
+
So that _a_d_b may be used on large files all appropriate values are kept as signed 32 bit integers.
values are kept as signed 32 bit integers.
 
  
  
 
+
== FILES ==
 
 
Printed 11/26/79  UNIX/32V  7
 
 
 
 
 
 
 
 
 
 
 
 
 
ADB(1)    UNIX Programmer's ManualADB(1)
 
 
 
 
 
 
 
FILES
 
 
/dev/mem
 
/dev/mem
 
/dev/swap
 
/dev/swap
Line 458: Line 339:
 
core
 
core
  
SEE ALSO
+
== SEE ALSO ==
ptrace(2), a.out(5), core(5)
+
[[32v 2m ptrace|ptrace(2)]], [[32v 5m a.out|a.out(5)]], [[32v 5m core|core(5)]]
 +
 
 +
== 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 com mand failed or returned nonzero status.
  
DIAGNOSTICS
+
== BUGS ==
`Adb' when there is no current command or format. Comments
+
A breakpoint set at the entry point is not effective on initial entry to the program. When single stepping, system calls do not count as an executed instruction. Local variables whose names are the same as an external variable may foul up the accessing of the external.
about inaccessible files, syntax errors, abnormal termina-
 
tion of commands, etc.  Exit status is 0, unless last com-
 
mand failed or returned nonzero status.
 
  
BUGS
+
[[Category:32v man section 1]]
A breakpoint set at the entry point is not effective on ini-
 
tial entry to the program.
 
When single stepping, system calls do not count as an exe-
 
cuted instruction.
 
Local variables whose names are the same as an external
 
variable may foul up the accessing of the external.
 

Latest revision as of 13:41, 26 October 2009

ADB(1) UNIX Programmer's ManualADB(1)


NAME

adb - debugger

SYNOPSIS

adb [-w] [ objfil [ corfil ] ]

DESCRIPTION

Adb is a general purpose debugging program. It may be used to examine files and to provide a controlled environment for the execution of UNIX programs.

Objfil is normally an executable program file, preferably containing a symbol table; if not then the symbolic features of adb cannot be used although the file can still be exam- ined. 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 the standard input and responses are to the standard output. If the -w flag is present then both objfil and corfil are created if necessary and opened for reading and writing so that files can be modified using adb. Adb ignores QUIT; INTERRUPT causes return to the next adb command.

In general requests to adb are of the form

[address] [,count] [command] [;]

If address is present then dot is set to address. Initially dot is set to 0. For most commands count specifies how many 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 it is used in. If a subprocess is being debugged then addresses are interpreted in the usual way in the address space of the subprocess. For further details of address mapping see ADDRESSES.

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.

integer

A number. The prefixes 0o and 0O (``zero oh) force interpretation in octal radix; the prefixes 0t and 0T force interpretation in decimal radix; the prefixes 0x and 0X force interpretation in hexadecimal radix. Thus 0o20 = 0t16 = 0x10 = sixteen. If no prefix appears, then the default radix is used; see the $d command. The default radix is initially hexadecimal. The hexadecimal digits are 0123456789abcdefABCDEF with the obvious values. 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. \ may be used to escape a '.

< name The value of name, which is either a variable name or a register name. _A_d_b maintains a number of variables (see VARIABLES) named by single letters or digits. If name is a register name then the value of the register is obtained from the system header in corfil. The register names are those printed by the $r command.

symbol A symbol is a sequence of upper or lower case letters, underscores or digits, not starting with a digit. The value of the symbol is taken from the symbol table in objfil. An initial _ or ~ will be prepended to symbol if needed.

_symbol In C, the `true name' of an external symbol begins with _. It may be necessary to utter this name to disinguish it from internal or hidden variables of a program.

routine.name The address of the variable name in the specified C routine. Both routine and name are symbols. If name is omitted the value is the address of the most recently activated C stack frame corresponding to routine.

(exp) The value of the expression exp.

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.

Dyadic operators are left associative and are less binding than monadic operators.

e1+e2 Integer addition.

e1-e2 Integer subtraction.

_e_1*_e_2 Integer multiplication.

_e_1%_e_2 Integer division.

_e_1&_e_2 Bitwise conjunction.

_e_1|_e_2 Bitwise disjunction.

_e_1#_e_2 _E_1 rounded up to the next multiple of _e_2.

COMMANDS

Most commands consist of a verb followed by a modifier or list of modifiers. The following verbs are available. (The commands `?' and `/' may be followed by `*'; see ADDRESSES for further details.)

?_f Locations starting at _a_d_d_r_e_s_s in _o_b_j_f_i_l are printed according to the format _f. _d_o_t is incremented by the sum of the increments for each format letter (q.v.).

/_f Locations starting at _a_d_d_r_e_s_s in _c_o_r_f_i_l are printed according to the format _f and _d_o_t is incremented as for `?'.

=_f The value of _a_d_d_r_e_s_s itself is printed in the styles indicated by the format _f. (For i format `?' is printed for the parts of the instruction that reference subsequent words.)

A _f_o_r_m_a_t consists of one or more characters that specify a style of printing. Each format character may be preceded by a decimal integer that is a repeat count for the format character. While stepping through a format _d_o_t is incre- mented by the amount given for each format letter. If no format is given then the last format is used. The format letters available are as follows.

o 2 Print 2 bytes in octal. All octal numbers output by _a_d_b are preceded by 0. 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. r 2 Print in default radix. R 4 Print long default radix. 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 the 32 bit value as a floating point number. F 8 Print double floating point. b 1 Print the addressed byte in octal. c 1 Print the addressed character. C 1 Print the addressed character using the following escape convention. Character values 000 to 040 are printed as @ followed by the corresponding character in the range 0100 to 0140. The charac- ter @ is printed as @@. s _n Print the addressed characters until a zero char- acter is reached. S _n Print a string using the @ escape convention. _n is the length of the string including its zero terminator. Y 4 Print 4 bytes in date format (see _c_t_i_m_e(3)). i n Print as PDP11 instructions. _n is the number of bytes occupied by the instruction. This style of printing causes variables 1 and 2 to be set to the offset parts of the source and destination respec- tively. a 0 Print the value of _d_o_t in symbolic form. Symbols are checked to ensure that they have an appropri- ate type as indicated below.

/ local or global data symbol ? local or global text symbol = local or global absolute symbol

p 2 Print the addressed value in symbolic form using the same rules for symbol lookup as a. t 0 When preceded by an integer tabs 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 newline. "..." 0 Print the enclosed string. ^ _D_o_t is decremented by the current increment. Nothing is printed. + _D_o_t is incremented by 1. Nothing is printed. - _D_o_t is decremented by 1. Nothing is printed.

newline Repeat the previous command with a _c_o_u_n_t of 1.

[?/]l _v_a_l_u_e _m_a_s_k Words starting at _d_o_t are masked with _m_a_s_k and compared with _v_a_l_u_e until a match is found. If L is used then the match is for 4 bytes at a time instead of 2. If no match is found then _d_o_t is unchanged; otherwise _d_o_t is set to the matched location. If _m_a_s_k is omitted then -1 is used.

[?/]w _v_a_l_u_e ... Write the 2-byte _v_a_l_u_e 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 _b_1 _e_1 _f_1[?/] New values for (_b_1, _e_1, _f_1) are recorded. If less than three expressions are given then the remaining map parameters are left unchanged. If the `?' or `/' is followed by `*' then the second segment (_b_2,_e_2,_f_2) of the mapping is changed. If the list is terminated by `?' or `/' then the file (_o_b_j_f_i_l or _c_o_r_f_i_l respec- tively) is used for subsequent requests. (So that, for example, `/m?' will cause `/' to refer to _o_b_j_f_i_l.)

>_n_a_m_e _D_o_t is assigned to the variable or register named.

! A shell is called to read the rest of the line follow- ing `!'.

$_m_o_d_i_f_i_e_r Miscellaneous commands. The available _m_o_d_i_f_i_e_r_s are:

<_f Read commands from the file _f and return. >_f Send output to the file _f, which is created if it does not exist. r Print the general registers and the instruction addressed by pc. _D_o_t is set to pc. b Print all breakpoints and their associated counts and commands. a ALGOL 68 stack backtrace. If _a_d_d_r_e_s_s is given then it is taken to be the address of the current frame (instead of r4). If _c_o_u_n_t is given then only the first _c_o_u_n_t frames are printed. c C stack backtrace. If _a_d_d_r_e_s_s is given then it is taken as the address of the current frame (instead of r5). If C is used then the names and (16 bit) values of all automatic and static variables are printed for each active function. If _c_o_u_n_t is given then only the first _c_o_u_n_t frames are printed. d Set the default radix to _a_d_d_r_e_s_s and report the new value. Note that _a_d_d_r_e_s_s is interpreted in the (old) current radix. Thus ``10$d never changes the default radix. To make decimal the default radix, use ``0t10$d. e The names and values of external variables are printed. w Set the page width for output to _a_d_d_r_e_s_s (default 80). s Set the limit for symbol matches to _a_d_d_r_e_s_s (default 255). o All integers input are regarded as octal. d Reset integer input as described in EXPRESSIONS. q Exit from _a_d_b. v Print all non zero variables in octal. m Print the address map.

_m_o_d_i_f_i_e_r

Manage a subprocess. Available modifiers are:

b_c Set breakpoint at _a_d_d_r_e_s_s. The breakpoint is exe- cuted _c_o_u_n_t-1 times before causing a stop. Each time the breakpoint is encountered the command _c is executed. If this command sets _d_o_t to zero then the breakpoint causes a stop.

d Delete breakpoint at _a_d_d_r_e_s_s.

r Run _o_b_j_f_i_l as a subprocess. If _a_d_d_r_e_s_s is given explicitly then the program is entered at this point; otherwise the program is entered at its standard entry point. _c_o_u_n_t specifies how many breakpoints are to be 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 on entry to the subprocess.

c_s The subprocess is continued with signal _s c _s, see _s_i_g_n_a_l(2). If _a_d_d_r_e_s_s is given then the subpro- cess is continued at this address. If no signal is specified then the signal that caused the sub- process to stop is sent. Breakpoint skipping is the same as for r.

s_s As for c except that the subprocess is single stepped _c_o_u_n_t times. If there is no current subprocess then _o_b_j_f_i_l 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.

k The current subprocess, if any, is terminated.

VARIABLES

_A_d_b provides a number of variables. Named variables are set initially by _a_d_b 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.

On entry the following are set from the system header in the _c_o_r_f_i_l. If _c_o_r_f_i_l does not appear to be a core file then these values are set from _o_b_j_f_i_l.

b The base address of the data segment. d The data segment size. e The entry point. m The `magic' number (0405, 0407, 0410 or 0411). s The stack segment size. t The text segment size.

ADDRESSES 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 (_b_1, _e_1, _f_1) and (_b_2, _e_2, _f_2) and the _f_i_l_e _a_d_d_r_e_s_s corresponding to a written _a_d_d_r_e_s_s is calculated as follows.

  _b_1<__a_d_d_r_e_s_s<_e_1 => _f_i_l_e _a_d_d_r_e_s_s=_a_d_d_r_e_s_s+_f_1-_b_1, otherwise,
  _b_2<__a_d_d_r_e_s_s<_e_2 => _f_i_l_e _a_d_d_r_e_s_s=_a_d_d_r_e_s_s+_f_2-_b_2,

otherwise, the requested _a_d_d_r_e_s_s is not legal. In some cases (e.g. for programs with separated I and D space) the two segments for a file may overlap. If a ? or / is fol- lowed by an * then 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 then, for that file, _b_1 is set to 0, _e_1 is set to the maximum file size and _f_1 is set to 0; in this way the whole file can be examined with no address translation.

So that _a_d_b may be used on large files all appropriate values are kept as signed 32 bit integers.


FILES

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

SEE ALSO

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

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 com mand failed or returned nonzero status.

BUGS

A breakpoint set at the entry point is not effective on initial entry to the program. When single stepping, system calls do not count as an executed instruction. Local variables whose names are the same as an external variable may foul up the accessing of the external.