4.3BSD-Reno/share/man/cat1/adb.0

Compare this file to the similar file:
Show the results in this format:

ADB(1)			    UNIX Reference Manual			ADB(1)

NNAAMMEE
     aaddbb - debugger

SSYYNNOOPPSSIISS
     aaddbb [--ww] [--kk] [--II_d_i_r] [_o_b_j_f_i_l [_c_o_r_f_i_l]]

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

     _O_b_j_f_i_l is normally an executable program file, preferably containing a
     symbol table; if not then the symbolic features of aaddbb cannot be used
     although the file can still be examined.  The default for _o_b_j_f_i_l is
     _a._o_u_t.  _C_o_r_f_i_l is assumed to be a core image file produced after execut-
     ing _o_b_j_f_i_l; the default for _c_o_r_f_i_l is _c_o_r_e

     Requests to aaddbb are read from the standard input and responses are to the
     standard output.  If the --ww flag is present then both _o_b_j_f_i_l and _c_o_r_f_i_l
     are created if necessary and opened for reading and writing so that files
     can be modified using aaddbb.

     The --kk option makes aaddbb do UNIX kernel memory mapping; it should be used
     when _c_o_r_e is a UNIX crash dump or /_d_e_v/_m_e_m.

     The --II option specifies a directory where files to be read with $$<< or $$<<<<
     (see below) will be sought; the default is /_u_s_r/_l_i_b/_a_d_b.

     AAddbb ignores QUIT; INTERRUPT causes return to the next aaddbb command.

     In general requests to aaddbb are of the form

	   [_a_d_d_r_e_s_s] [ _c_o_u_n_t] [ccoommmmaanndd] [;]

     If _a_d_d_r_e_s_s is present then _d_o_t is set to _a_d_d_r_e_s_s.	Initially _d_o_t is set
     to 0.  For most commands _c_o_u_n_t specifies how many times the command will
     be executed.  The default _c_o_u_n_t is 1.  _A_d_d_r_e_s_s and _c_o_u_n_t 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.	If the operating sys-
     tem is being debugged either post-mortem or using the special file
     /_d_e_v/_m_e_m to interactively examine and/or modify memory, the maps are set
     to map the kernel virtual addresses which start at 0x80000000 (on the
     VAX); see ADDRESSES below.

EEXXPPRREESSSSIIOONNSS
     ..		     The value of _d_o_t.

     ++		     The value of _d_o_t incremented by the current increment.

     ^^		     The value of _d_o_t decremented by the current increment.

     ""		     The last _a_d_d_r_e_s_s typed.

     _i_n_t_e_g_e_r	     A number.	The prefixes 0o and 0O (zero oh) force in-
		     terpretation 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
		     _d_e_f_a_u_l_t _r_a_d_i_x is used; see the $$dd 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
		     A 32 bit floating point number.

     'cccc'	     The ASCII value of up to 4 characters.  \ may be used to
		     escape a '.

     < _n_a_m_e	     The value of _n_a_m_e, which is either a variable name or a
		     register name.  AAddbb maintains a number of variables (see
		     VARIABLES below) 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 $$rr command.

     _s_y_m_b_o_l	     A _s_y_m_b_o_l is a sequence of upper or lower case letters,
		     underscores or digits, not starting with a digit.	The
		     backslash character \ may be used to escape other charac-
		     ters.  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 _ will be prepended to
		     _s_y_m_b_o_l if needed.

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

     _r_o_u_t_i_n_e._n_a_m_e    The address of the variable _n_a_m_e in the specified C rou-
		     tine.  Both _r_o_u_t_i_n_e and _n_a_m_e are _s_y_m_b_o_l_s.	If _r_o_u_t_i_n_e is
		     omitted, the currently active frame is used.  (This form
		     is currently broken; local variables can be examined only
		     with dbx(1)).  If _n_a_m_e is omitted the value is the ad-
		     dress of the most recently activated C stack frame
		     corresponding to _r_o_u_t_i_n_e (this much works).

     (exp)	     The value of the expression _e_x_p.

  MMoonnaaddiicc OOppeerraattoorrss

	   *_e_x_p                The contents of the location addressed by _e_x_p
			       in _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.
	   #_e_x_p                Logical negation.


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


CCOOMMMMAANNDDSS
     Most commands consist of a verb followed by a modifier or list of modif-
     iers.  The following verbs are available.	(The commands ??  and / may be
     followed by *; see the ADDRESSES section 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 zero values are assumed 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 incremented by the amount given for each format letter.
     If no format is given then the last format is used.  The format charac-
     ters available are as follows.  Note that a backslash (\) must be used to
     quote the three numeric formats.

	   11  _1      Print 1 byte in the current radix (which may be either
		     signed or unsigned; see the $$dd command).
	   22  _2      Print 2 bytes in the current radix.
	   44  _4      Print 4 bytes in the current radix.
	   vv  _2      Print 2 bytes in the signed variant of the current radix.
	   VV  _4      Print 4 bytes in the signed variant of the current radix.
	   oo  _2      Print 2 bytes in unsigned octal.  All octal numbers
		     output by aaddbb are preceded by 0.
	   OO  _4      Print 4 bytes in unsigned octal.
	   qq  _2      Print 2 bytes in signed octal.
	   QQ  _4      Print 4 bytes in signed octal.
	   uu  _2      Print 2 bytes in unsigned decimal.
	   UU  _4      Print 4 bytes in long unsigned decimal.
	   dd  _2      Print 2 bytes in signed decimal.
	   DD  _4      Print 4 bytes in long signed decimal.
	   xx  _2      Print 2 bytes in unsigned hexadecimal.
	   XX  _4      Print 4 bytes in unsigned hexadecimal.
	   zz  _2      Print 2 bytes in signed hexadecimal.
	   ZZ  _4      Print 4 bytes in signed hexadecimal.
	   ff  _4      Print 4 bytes as a floating point number.
	   FF  _8      Print 8 bytes as a double floating point number.
	   bb  _1      Print 1 byte in unsigned octal.
	   cc  _1      Print 1 byte as a character.
	   CC  _1      Print 1 byte as a character, using the standard escape
		     convention where control characters are printed as ^_X and
		     the delete character is printed as ^?.
	   ss  _n      Print the addressed characters until a zero character is
		     reached.
	   SS  _n      Print a string using the ^_X escape convention (see _C
		     above).  _n is the length of the string including its zero
		     terminator.
	   YY  _4      Print 4 bytes in date format (see ctime(3)).
	   ii  _n      Print as machine instructions.  _n is the number of bytes
		     occupied by the instruction.  This style of printing
		     causes the numeric variables 1, 2, ... to be set accord-
		     ing to the offset parts of the arguments, if any, of the
		     instruction (up to 6 on the VAX).
	   aa  _0      Print the value of _d_o_t in symbolic form.  Symbols are
		     checked to ensure that they have an appropriate type as
		     indicated below.

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

	   pp  _4      Print the addressed value in symbolic form using the same
		     rules for symbol lookup as aa.
	   tt  _0      When preceded by an integer tabs to the next appropriate
		     tab stop.	For example, 8t moves to the next 8-space tab
		     stop.
	   rr  _0      Print a space.
	   nn  _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.


     [??//]ll _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 LL 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 all bits are compared.

     [??//]ww _v_a_l_u_e ...
		 Write the 2-byte _v_a_l_u_e into the addressed location.  If the
		 command is WW, write 4 bytes.  Odd addresses _a_r_e allowed when
		 writing to the subprocess address space.

     [??//]mm _b_1 _e_1 _f_1[??//]
		 New values for (_b_1, _e_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 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
		 respectively) is used for subsequent requests.  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 (/_b_i_n/_s_h) is called to read the rest of the line
		 following !!.

     $$_m_o_d_i_f_i_e_r	 Miscellaneous commands.  The available _m_o_d_i_f_i_e_r_s are:

		 <<_f_i_l_e
		       Read commands from _f_i_l_e If this command is executed in
		       a file, further commands in the file are not seen.  If
		       _f_i_l_e is omitted, the current input stream is terminat-
		       ed.  If a _c_o_u_n_t 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_i_l_e is execut-
		       ed.

		 <<<<_f_i_l_e
		       Similar to << except it can be used in a file of com-
		       mands without causing the file to be closed.  Variable
		       _9 is saved during the execution of this command, and
		       restored when it completes.  There is a (small) finite
		       limit to the number of <<<< files that can be open at
		       once.

		 >>_f_i_l_e
		       Append output to the file _f_i_l_e, which is created if it
		       does not exist.	If _f_i_l_e is omitted, output is returned
		       to the terminal.

		 ??_f_i_l_e
		       Print process id, the signal which caused stoppage or
		       termination, as well as the registers as $$rr.  This is
		       the default if _m_o_d_i_f_i_e_r is omitted.

		 rr     Print the general registers and the instruction ad-
		       dressed by ppcc.  _D_o_t is set to ppcc.

		 bb     Print all breakpoints and their associated counts and
		       commands.

		 cc     C stack backtrace.  If _a_d_d_r_e_s_s is given then it is tak-
		       en as the address of the current frame instead of the
		       contents of the frame-pointer register.	If CC is used
		       then the names and (32 bit) values of all automatic and
		       static variables are printed for each active function
		       (this is partially broken; the names are not now avail-
		       able).  If _c_o_u_n_t is given then only the first _c_o_u_n_t
		       frames are printed.

		 dd     Set the default radix to _a_d_d_r_e_s_s and report the new
		       value.  If no _a_d_d_r_e_s_s is given, the default radix is
		       not changed.  The new radix must be between -16 (de-
		       cimal) and 16 (decimal) and must not be 0, 1, or -1.  A
		       negative radix implies that numbers printed in that ra-
		       dix will be treated as signed; otherwise they are
		       treated as unsigned.  Note that _a_d_d_r_e_s_s is interpreted
		       in the (old) current radix.  Thus 10$d simply changes
		       the default radix to unsigned.  To make signed decimal
		       the default radix, use -0t10$d.

		 ee     The names and values of external variables are printed.

		 ww     Set the page width for output to _a_d_d_r_e_s_s (default 80).

		 ss     Set the limit for symbol matches to _a_d_d_r_e_s_s (default
		       1024).

		 qq     Exit from aaddbb.

		 vv     Print all non zero variables in octal.

		 mm     Print the address map.

		 pp     (_K_e_r_n_e_l _d_e_b_u_g_g_i_n_g) Change the current kernel memory
		       mapping to map the designated uusseerr ssttrruuccttuurree to the ad-
		       dress given by the symbol __uu.  The _a_d_d_r_e_s_s argument is
		       the address of the user's user page table entries.

     :_m_o_d_i_f_i_e_r	 Manage a subprocess.  Available modifiers are:

		 bb_c    Set breakpoint at _a_d_d_r_e_s_s.  The breakpoint is executed
		       _c_o_u_n_t-_1 times before causing a stop, after which it
		       stops unconditionally.  Each time the breakpoint is en-
		       countered the command _c is executed.  If this command
		       is omitted or sets _d_o_t to zero, the breakpoint causes a
		       stop immediately, regardless of any remaining count.

		 dd     Delete breakpoint at _a_d_d_r_e_s_s.

		 DD     Delete all breakpoints.

		 rr     Run _o_b_j_f_i_l as a subprocess.  If _a_d_d_r_e_s_s is given expli-
		       citly then the program is entered at this point; other-
		       wise 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.

		 cc_s    The subprocess is continued with signal _s see
		       sigvec(2).  If _a_d_d_r_e_s_s is given then the subprocess is
		       continued at this address.  If no signal is specified
		       then the signal that caused the subprocess to stop is
		       sent.  Breakpoint skipping is the same as for rr.

		 ss_s    As for cc 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 rr.	In this case
		       no signal can be sent; the remainder of the line is
		       treated as arguments to the subprocess.

		 kk     The current subprocess, if any, is terminated.

VVAARRIIAABBLLEESS
     AAddbb provides a number of variables.  Named variables are set initially by
     aaddbb 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.  This continues up
	   through at most 6 on the VAX.  For a three-operand instruction,
	   variable 2 is the second source offset and variable 3 the destina-
	   tion offset part.
     9	   The count on the last $< or $<< command.

     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 _c_o_r_e 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 (0407, 0410 or 0413).
     s	   The stack segment size.
     t	   The text segment size.

AADDDDRREESSSSEESS
     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 and (_b_2, _e_2 and the _f_i_l_e _a_d_d_r_e_s_s corresponding to a writ-
     ten _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 followed by an ** then only the second triple is
     used.

     The initial setting of both mappings is suitable for normal _a._o_u_t and
     _c_o_r_e 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 transla-
     tion.

FFIILLEESS
     _a._o_u_t
     _c_o_r_e


SSEEEE AALLSSOO
     cc(1), dbx(1), ptrace(2), a.out(5), core(5)

HHIISSTTOORRYY
     AAddbb was first released with Version 7 AT&T UNIX.  The version of aaddbb this
     man page describes is descended from the orignial.

DDIIAAGGNNOOSSTTIICCSS
     `adb' when there is no current command or format.	Comments about inac-
     cessible files, syntax errors, abnormal termination of commands, etc.
     Exit status is 0, unless last command failed or returned nonzero status.

BBUUGGSS
     Since no shell is invoked to interpret the arguments of the ::rr command,
     the customary wild-card and variable expansions cannot occur.