xref: /csrg-svn/old/adb/common_source/adb.1 (revision 47822)
1*47822Sbostic.\" Copyright (c) 1990 The Regents of the University of California.
2*47822Sbostic.\" All rights reserved.
319073Smckusick.\"
4*47822Sbostic.\" %sccs.include.proprietary.man%
519073Smckusick.\"
6*47822Sbostic.\"	@(#)adb.1	5.10 (Berkeley) 04/04/91
7*47822Sbostic.\"
843080Scael.Dd
943080Scael.Dt ADB 1
1043080Scael.Os BSD 4
1143080Scael.Sh NAME
1243080Scael.Nm adb
1343080Scael.Nd debugger
1443080Scael.Sh SYNOPSIS
1543080Scael.Nm adb
1643080Scael.Op Fl w
1743080Scael.Op Fl k
1843080Scael.Oo
1943080Scael.Op Fl I Ar dir
2043080Scael.Oo
2143080Scael.Op Ar objfil Op Ar corfil
2243080Scael.Sh DESCRIPTION
2343080Scael.Nm Adb
2419073Smckusickis a general purpose debugging program.
2519073SmckusickIt may be used to examine files and to provide
2619074Smckusicka controlled environment for the execution of UNIX programs.
2743080Scael.Pp
2843080Scael.Ar Objfil
2919073Smckusickis normally an executable program file, preferably
3019074Smckusickcontaining a symbol table; if not then the symbolic features of
3143080Scael.Nm adb
3219074Smckusickcannot be used although the file can still be examined.
3319073SmckusickThe default for
3443080Scael.Ar objfil
3519073Smckusickis
3643080Scael.Pa a.out .
3743080Scael.Ar Corfil
3819074Smckusickis assumed to be a core image file produced after executing
3943080Scael.Ar objfil ;
4019073Smckusickthe default for
4143080Scael.Ar corfil
4219073Smckusickis
4343080Scael.Pa core
4443080Scael.Pp
4519073SmckusickRequests to
4643080Scael.Nm adb
4719074Smckusickare read from the standard input and responses are to the standard output.
4819073SmckusickIf the
4943080Scael.Fl w
5019073Smckusickflag is present then both
5143080Scael.Ar objfil
5219073Smckusickand
5343080Scael.Ar corfil
5419074Smckusickare created if necessary and opened for reading and writing
5519073Smckusickso that files can be modified using
5643080Scael.Nm adb .
5743080Scael.Pp
5843080ScaelThe
5943080Scael.Fl k
6043080Scaeloption makes
6143080Scael.Nm adb
6243080Scaeldo UNIX kernel memory
6343080Scaelmapping; it should be used when
6443080Scael.Pa core
6543080Scaelis a UNIX crash dump
6643080Scaelor
6743080Scael.Pa /dev/mem .
6843080Scael.Pp
6943080ScaelThe
7043080Scael.Fl I
7143080Scaeloption specifies a directory where files to be read
7243080Scaelwith
7344951Scael.Ic $<
7443080Scaelor
7544951Scael.Ic $<<
7643080Scael(see below) will be sought; the default is
7743080Scael.Pa /usr/lib/adb .
7843080Scael.Pp
7943080Scael.Nm Adb
8043080Scaelignores
8143080Scael.Li QUIT ;
8243080Scael.Li INTERRUPT
8343080Scaelcauses return to the next
8443080Scael.Nm adb
8519073Smckusickcommand.
8643080Scael.Pp
8719073SmckusickIn general requests to
8843080Scael.Nm adb
8919073Smckusickare of the form
9043080Scael.Pp
9143080Scael.ti +\n(Dsu
9243080Scael.Op Ad address
9343080Scael.Op \&, Va count
9443080Scael.Op Ic command
9543080Scael.Op \&;
9643080Scael.Pp
9719073SmckusickIf
9843080Scael.Ad address
9919073Smckusickis present then
10043080Scael.Ad dot
10119073Smckusickis set to
10243080Scael.Ad address .
10319073SmckusickInitially
10443080Scael.Ad dot
10519074Smckusickis set to 0.  For most commands
10643080Scael.Va count
10719074Smckusickspecifies how many times the command will be executed.  The default
10843080Scael.Va count
10919073Smckusickis 1.
11043080Scael.Ad Address
11119073Smckusickand
11243080Scael.Va count
11319073Smckusickare expressions.
11443080Scael.Pp
11519074SmckusickThe interpretation of an address depends on the context it is used in.
11619074SmckusickIf a subprocess is being debugged then addresses are interpreted
11719073Smckusickin the usual way in the address space of the subprocess.
11819073SmckusickIf the operating system is being debugged either post-mortem or using
11919073Smckusickthe special file
12043080Scael.Pa /dev/mem
12137104Sjakto interactively examine and/or modify memory, the maps are set to map
12243080Scaelthe kernel virtual addresses which start at
12343080Scael.Li \&0x80000000
12443080Scael(on the VAX); see ADDRESSES below.
12543080Scael.Sh EXPRESSIONS
12643080Scael.Tw Li
12743080Scael.Tp Sy \&\.
12819073SmckusickThe value of
12943080Scael.Ad dot .
13043080Scael.Tp  Sy \&\+
13119073SmckusickThe value of
13243080Scael.Ad dot
13319073Smckusickincremented by the current increment.
13443080Scael.Tp Sy \&^
13519073SmckusickThe value of
13643080Scael.Ad dot
13719073Smckusickdecremented by the current increment.
13843080Scael.Tp Sy \&"
13919073SmckusickThe last
14043080Scael.Ad address
14119073Smckusicktyped.
14243080Scael.Tp Va integer
14343080ScaelA number.  The prefixes
14443080Scael.Li \&0o
14543080Scaeland
14643080Scael.Li \&0O
14743080Scael(\*(lqzero oh\*(rq)
14843080Scaelforce interpretation
14943080Scaelin octal radix; the prefixes
15043080Scael.Li 0t
15143080Scaeland
15243080Scael.Li 0T
15343080Scaelforce interpretation in
15443080Scaeldecimal radix; the prefixes
15543080Scael.Li 0x
15643080Scaeland
15743080Scael.Li 0X
15843080Scaelforce interpretation in
15943080Scaelhexadecimal radix.  Thus
16043080Scael.Li 0o20
16143080Scael=
16243080Scael.Li 0t16
16343080Scael=
16443080Scael.Li 0x10
16543080Scael= sixteen.
16619073SmckusickIf no prefix appears, then the
16743080Scael.Em default radix
16843080Scaelis used; see the
16944951Scael.Ic $d
17043080Scaelcommand.  The default radix is initially hexadecimal.
17143080ScaelThe hexadecimal digits are
17243080Scael.Li 0123456789abcdefABCDEF
17343080Scaelwith the obvious
17419073Smckusickvalues.  Note that a hexadecimal number whose most significant
17543080Scaeldigit would otherwise be an alphabetic character must have a
17643080Scael.Li 0x
17743080Scael(or
17843080Scael.Li 0X )
17943080Scaelprefix (or a leading zero if the default radix is hexadecimal).
18043080Scael.Tp Va integer.fraction
18119073SmckusickA 32 bit floating point number.
18243080Scael.Tp Li \'cccc\'
18319073SmckusickThe ASCII value of up to 4 characters.
18443080Scael.Li \e
18543080Scaelmay be used to escape a
18643080Scael.Li \' .
18743080Scael.Tp Va < name
18819073SmckusickThe value of
18943080Scael.Va name ,
19019073Smckusickwhich is either a variable name or a register name.
19143080Scael.Nm Adb
19219074Smckusickmaintains a number of variables (see
19343080ScaelVARIABLES below)
19419073Smckusicknamed by single letters or digits.
19519073SmckusickIf
19643080Scael.Va name
19719074Smckusickis a register name then the value of the register is obtained from
19819073Smckusickthe system header in
19943080Scael.Ar corfil .
20043080ScaelThe register names are those printed by the
20144951Scael.Ic $r
20243080Scaelcommand.
20343080Scael.Tp Va symbol
20419073SmckusickA
20543080Scael.Va symbol
20619074Smckusickis a sequence of upper or lower case letters, underscores or
20719074Smckusickdigits, not starting with a digit.  The backslash character
20843080Scael.Li \e
20919074Smckusickmay be used to escape other characters.  The value of the
21043080Scael.Va symbol
21119074Smckusickis taken from the symbol table in
21243080Scael.Ar objfil .
21343080ScaelAn initial
21443080Scael.Li \_
21543080Scaelwill be prepended to
21643080Scael.Va symbol
21719073Smckusickif needed.
21843080Scael.Tp Va _symbol
21943080ScaelIn C, the `true name' of an external symbol begins with
22043080Scael.Li \_ .
22119074SmckusickIt may be necessary to utter this name to distinguish it
22219073Smckusickfrom internal or hidden variables of a program.
22343080Scael.Tp Va routine.name
22419073SmckusickThe address of the variable
22543080Scael.Va name
22619074Smckusickin the specified C routine.  Both
22743080Scael.Va routine
22819073Smckusickand
22943080Scael.Va name
23019073Smckusickare
23143080Scael.Va symbols .
23219073SmckusickIf
23343080Scael.Va routine
23436569Sbosticis omitted, the currently active frame is used.
23536569Sbostic(This form is currently broken; local variables can be examined
23636569Sbosticonly with
23743080Scael.Xr dbx 1 ) .
23836569SbosticIf
23943080Scael.Va name
24036569Sbosticis omitted the value is the address
24136569Sbosticof the most recently activated C stack frame
24219073Smckusickcorresponding to
24343080Scael.Va routine
24436569Sbostic(this much works).
24543080Scael.Tp (exp)
24643080Scael.\" .Tp Cx \&(\&
24743080Scael.\" .Va exp
24843080Scael.\" .Cx \&)\&
24919073SmckusickThe value of the expression
25043080Scael.Va exp .
25143080Scael.Tp
25243080Scael.Pp
25343080Scael.Ss Monadic Operators
25443080Scael.Pp
25543080Scael.Dp Cx Li \&*
25643080Scael.Va exp
25743080Scael.Cx
25819074SmckusickThe contents of the location addressed by
25943080Scael.Va exp
26019073Smckusickin
26143080Scael.Ar corfil .
26243080Scael.Dp Cx Li \&@
26343080Scael.Va exp
26443080Scael.Cx
26519073SmckusickThe contents of the location addressed by
26643080Scael.Va exp
26719073Smckusickin
26843080Scael.Ar objfil .
26943080Scael.Dp Cx Li \&\-
27043080Scael.Va exp
27143080Scael.Cx
27219073SmckusickInteger negation.
27343080Scael.Dp Cx Li \&~
27443080Scael.Va exp
27543080Scael.Cx
27619073SmckusickBitwise complement.
27743080Scael.Dp Cx Li \&#
27843080Scael.Va exp
27943080Scael.Cx
28019073SmckusickLogical negation.
28143080Scael.Dp
28243080Scael.Ss Dyadic operators
28319074Smckusickare left associative and are less binding than monadic operators.
28443080Scael.Dp Cx Va e1
28543080Scael.Li \&\+
28643080Scael.Va e2
28743080Scael.Cx
28819073SmckusickInteger addition.
28943080Scael.Dp Cx Va e1
29043080Scael.Li \&\-
29143080Scael.Va e2
29243080Scael.Cx
29319073SmckusickInteger subtraction.
29443080Scael.Dp Cx Va e1
29543080Scael.Li \&*
29643080Scael.Va e2
29743080Scael.Cx
29819073SmckusickInteger multiplication.
29943080Scael.Dp Cx Va e1
30043080Scael.Li \&%
30143080Scael.Va e2
30243080Scael.Cx
30319073SmckusickInteger division.
30443080Scael.Dp Cx Va e1
30543080Scael.Li &
30643080Scael.Va e2
30743080Scael.Cx
30819073SmckusickBitwise conjunction.
30943080Scael.Dp Cx Va e1
31043080Scael.Li \&|
31143080Scael.Va e2
31243080Scael.Cx
31319073SmckusickBitwise disjunction.
31443080Scael.Dp Cx Va e1
31543080Scael.Li #
31643080Scael.Va e2
31743080Scael.Cx
31843080Scael.Va E1
31919073Smckusickrounded up to the next multiple of
32043080Scael.Va e2 .
32143080Scael.Dp
32243080Scael.Sh COMMANDS
32319074SmckusickMost commands consist of a verb followed by a modifier or list of modifiers.
32419073SmckusickThe following verbs are available.
32543080Scael(The commands
32643080Scael.Ic ?
32743080Scaeland
32843080Scael.Li /
32943080Scaelmay be followed by
33043080Scael.Li * ;
33143080Scaelsee the
33243080ScaelADDRESSES section
33319073Smckusickfor further details.)
33443080Scael.Tw XXX
33543080Scael.Tp Cx Ic ?
33643080Scael.Va f
33743080Scael.Cx
33819073SmckusickLocations starting at
33943080Scael.Ad address
34019073Smckusickin
34143080Scael.Ar objfil
34219073Smckusickare printed according to the format
34343080Scael.Va f .
34443080Scael.Ad dot
34519073Smckusickis incremented by the sum of the increments for each format letter (q.v.).
34643080Scael.Tp Cx Ic /
34743080Scael.Va f
34843080Scael.Cx
34919073SmckusickLocations starting at
35043080Scael.Ad address
35119073Smckusickin
35243080Scael.Ar corfil
35319073Smckusickare printed according to the format
35443080Scael.Va f
35519073Smckusickand
35643080Scael.Ad dot
35743080Scaelis incremented as for
35843080Scael.Ic ? .
35943080Scael.Tp Cx Ic =
36043080Scael.Va f
36143080Scael.Cx
36219073SmckusickThe value of
36343080Scael.Ad address
36419074Smckusickitself is printed in the styles indicated by the format
36543080Scael.Va f .
36619073Smckusick(For
36743080Scael.Va i
36836569Sbosticformat zero values are assumed
36936569Sbosticfor the parts of the instruction that reference
37019073Smckusicksubsequent words.)
37143080Scael.Tp
37243080Scael.Pp
37319073SmckusickA
37443080Scael.Va format
37519074Smckusickconsists of one or more characters that specify a style of printing.
37619073SmckusickEach format character may be preceded by a decimal integer
37719073Smckusickthat is a repeat count for the format character.
37819073SmckusickWhile stepping through a format
37943080Scael.Ad dot
38019074Smckusickis incremented by the amount given for each format letter.
38119073SmckusickIf no format is given then the last format is used.
38236569SbosticThe format characters available are as follows.
38343080ScaelNote that a backslash
38443080Scael.Cx (
38543080Scael.Li \e
38643080Scael.Cx )
38743080Scael.Cx
38843080Scaelmust be used
38936569Sbosticto quote the three numeric formats.
39043080Scael.Dw \&M_____\&M
39143080Scael.Dp Cx Ic 1
39243080Scael.Cx \&\ \ \&
39343080Scael.Va 1
39443080Scael.Cx
39536569SbosticPrint 1 byte in the current radix
39643080Scael(which may be either signed or unsigned; see the
39744951Scael.Ic $d
39843080Scaelcommand).
39943080Scael.Dp Cx Ic 2
40043080Scael.Cx \&\ \ \&
40143080Scael.Va 2
40243080Scael.Cx
40336569SbosticPrint 2 bytes in the current radix.
40443080Scael.Dp Cx Ic 4
40543080Scael.Cx \&\ \ \&
40643080Scael.Va 4
40743080Scael.Cx
40836569SbosticPrint 4 bytes in the current radix.
40943080Scael.Dp Cx Ic v
41043080Scael.Cx \&\ \ \&
41143080Scael.Va 2
41243080Scael.Cx
41336569SbosticPrint 2 bytes in the signed variant of the current radix.
41443080Scael.Dp Cx Ic V
41543080Scael.Cx \&\ \ \&
41643080Scael.Va 4
41743080Scael.Cx
41836569SbosticPrint 4 bytes in the signed variant of the current radix.
41943080Scael.Dp Cx Ic o
42043080Scael.Cx \&\ \ \&
42143080Scael.Va 2
42243080Scael.Cx
42336569SbosticPrint 2 bytes in unsigned octal.  All octal numbers output by
42443080Scael.Nm adb
42536569Sbosticare preceded by 0.
42643080Scael.Dp Cx Ic O
42743080Scael.Cx \&\ \ \&
42843080Scael.Va 4
42943080Scael.Cx
43036569SbosticPrint 4 bytes in unsigned octal.
43143080Scael.Dp Cx Ic q
43243080Scael.Cx \&\ \ \&
43343080Scael.Va 2
43443080Scael.Cx
43536569SbosticPrint 2 bytes in signed octal.
43643080Scael.Dp Cx Ic Q
43743080Scael.Cx \&\ \ \&
43843080Scael.Va 4
43943080Scael.Cx
44036569SbosticPrint 4 bytes in signed octal.
44143080Scael.Dp Cx Ic u
44243080Scael.Cx \&\ \ \&
44343080Scael.Va 2
44443080Scael.Cx
44536569SbosticPrint 2 bytes in unsigned decimal.
44643080Scael.Dp Cx Ic U
44743080Scael.Cx \&\ \ \&
44843080Scael.Va 4
44943080Scael.Cx
45036569SbosticPrint 4 bytes in long unsigned decimal.
45143080Scael.Dp Cx Ic d
45243080Scael.Cx \&\ \ \&
45343080Scael.Va 2
45443080Scael.Cx
45536569SbosticPrint 2 bytes in signed decimal.
45643080Scael.Dp Cx Ic D
45743080Scael.Cx \&\ \ \&
45843080Scael.Va 4
45943080Scael.Cx
46036569SbosticPrint 4 bytes in long signed decimal.
46143080Scael.Dp Cx Ic x
46243080Scael.Cx \&\ \ \&
46343080Scael.Va 2
46443080Scael.Cx
46536569SbosticPrint 2 bytes in unsigned hexadecimal.
46643080Scael.Dp Cx Ic X
46743080Scael.Cx \&\ \ \&
46843080Scael.Va 4
46943080Scael.Cx
47036569SbosticPrint 4 bytes in unsigned hexadecimal.
47143080Scael.Dp Cx Ic z
47243080Scael.Cx \&\ \ \&
47343080Scael.Va 2
47443080Scael.Cx
47536569SbosticPrint 2 bytes in signed hexadecimal.
47643080Scael.Dp Cx Ic Z
47743080Scael.Cx \&\ \ \&
47843080Scael.Va 4
47943080Scael.Cx
48036569SbosticPrint 4 bytes in signed hexadecimal.
48143080Scael.Dp Cx Ic f
48243080Scael.Cx \&\ \ \&
48343080Scael.Va 4
48443080Scael.Cx
48536569SbosticPrint 4 bytes as a floating point number.
48643080Scael.Dp Cx Ic F
48743080Scael.Cx \&\ \ \&
48843080Scael.Va 8
48943080Scael.Cx
49036569SbosticPrint 8 bytes as a double floating point number.
49143080Scael.Dp Cx Ic b
49243080Scael.Cx \&\ \ \&
49343080Scael.Va 1
49443080Scael.Cx
49536569SbosticPrint 1 byte in unsigned octal.
49643080Scael.Dp Cx Ic c
49743080Scael.Cx \&\ \ \&
49843080Scael.Va 1
49943080Scael.Cx
50036569SbosticPrint 1 byte as a character.
50143080Scael.Dp Cx Ic C
50243080Scael.Cx \&\ \ \&
50343080Scael.Va 1
50443080Scael.Cx
50536569SbosticPrint 1 byte as a character, using
50619073Smckusickthe standard escape convention where control characters
50744951Scaelare printed as
50844951Scael.Cx \&^ Ar X
50944951Scael.Cx
51044951Scaeland the delete character is printed as ^?.
51143080Scael.Dp Cx Ic s
51243080Scael.Cx \&\ \ \&
51343080Scael.Va n
51443080Scael.Cx
51519074SmckusickPrint the addressed characters until a zero character is reached.
51643080Scael.Dp Cx Ic S
51743080Scael.Cx \&\ \ \&
51843080Scael.Va n
51943080Scael.Cx
52044951ScaelPrint a string using the
52144951Scael.Cx \&^ Ar X
52244951Scael.Cx
52343080Scaelescape convention (see
52443080Scael.Ar C
52543080Scaelabove).
52643080Scael.Ar n
52719073Smckusickis the length of the string including its zero terminator.
52843080Scael.Dp Cx Ic Y
52943080Scael.Cx \&\ \ \&
53043080Scael.Va 4
53143080Scael.Cx
53219073SmckusickPrint 4 bytes in date format (see
53343080Scael.Xr ctime 3 ) .
53443080Scael.Dp Cx Ic i
53543080Scael.Cx \&\ \ \&
53643080Scael.Va n
53743080Scael.Cx
53819074SmckusickPrint as machine instructions.
53943080Scael.Ar n
54019073Smckusickis the number of bytes occupied by the instruction.
54136569SbosticThis style of printing causes the numeric variables 1, 2, ... to be set
54236569Sbosticaccording to the offset parts of the arguments, if any, of the instruction
54336569Sbostic(up to 6 on the VAX).
54443080Scael.Dp Cx Ic a
54543080Scael.Cx \&\ \ \&
54643080Scael.Va 0
54743080Scael.Cx
54819073SmckusickPrint the value of
54943080Scael.Ad dot
55019073Smckusickin symbolic form.
55119073SmckusickSymbols are checked to ensure that they have an appropriate
55219073Smckusicktype as indicated below.
55343080Scael.Dw AAAA
55443080Scael.Dp Va /
55543080Scaellocal or global data symbol
55643080Scael.Dp Va \&?
55743080Scael.Cx
55843080Scaellocal or global text symbol
55943080Scael.Dp Va \&=
56043080Scael.Cx
56143080Scaellocal or global absolute symbol
56243080Scael.Dp
56343080Scael.Dp Cx Ic p
56443080Scael.Cx \&\ \ \&
56543080Scael.Va 4
56643080Scael.Cx
56719073SmckusickPrint the addressed value in symbolic form using
56819073Smckusickthe same rules for symbol lookup as
56943080Scael.Ic a .
57043080Scael.Dp Cx Ic t
57143080Scael.Cx \&\ \ \&
57243080Scael.Va 0
57343080Scael.Cx
57419074SmckusickWhen preceded by an integer tabs to the next appropriate tab stop.
57519073SmckusickFor example,
57643080Scael.Li 8t
57719073Smckusickmoves to the next 8-space tab stop.
57843080Scael.Dp Cx Ic r
57943080Scael.Cx \&\ \ \&
58043080Scael.Va 0
58143080Scael.Cx
58219073SmckusickPrint a space.
58343080Scael.Dp Cx Ic n
58443080Scael.Cx \&\ \ \&
58543080Scael.Va 0
58643080Scael.Cx
58719073SmckusickPrint a newline.
58844951Scael.Dp Ic \*(Lq...\*(Rq
58943080Scael.Va 0
59044951Scael.br
59119073SmckusickPrint the enclosed string.
59244951Scael.Dp Ic \&^
59343080Scael.Ad Dot
59419074Smckusickis decremented by the current increment.  Nothing is printed.
59544951Scael.Dp Ic \&+
59643080Scael.Ad Dot
59719074Smckusickis incremented by 1.  Nothing is printed.
59844951Scael.Dp Ic \&\-
59943080Scael.Ad Dot
60019074Smckusickis decremented by 1.  Nothing is printed.
60143080Scael.Dp newline
60219073SmckusickRepeat the previous command with a
60343080Scael.Va count
60419073Smckusickof 1.
60543080Scael.Dp
60643080Scael.Pp
60743080Scael.Tw $modifier
60843080Scael.Tp Cx Op Ic ?/
60943080Scael.Ic l\ \&
61043080Scael.Va value mask
61143080Scael.Cx
61219073SmckusickWords starting at
61343080Scael.Ad dot
61419073Smckusickare masked with
61543080Scael.Va mask
61643080Scaeland
61743080Scaelcompared with
61843080Scael.Va value
61919074Smckusickuntil a match is found.
62019073SmckusickIf
62143080Scael.Cm L
62219073Smckusickis used then the match is for 4 bytes at a time instead of 2.
62319073SmckusickIf no match is found then
62443080Scael.Ad dot
62519073Smckusickis unchanged; otherwise
62643080Scael.Ad dot
62719073Smckusickis set to the matched location.
62819073SmckusickIf
62943080Scael.Va mask
63036569Sbosticis omitted then all bits are compared.
63143080Scael.Tp Cx Op Ic ?/
63243080Scael.Ic w\ \&
63343080Scael.Va value ...
63443080Scael.Cx
63519073SmckusickWrite the 2-byte
63643080Scael.Va value
63719074Smckusickinto the addressed location.  If the command is
63843080Scael.Ic W ,
63919073Smckusickwrite 4 bytes.
64043080ScaelOdd addresses
64143080Scael.Em are
64243080Scaelallowed
64336569Sbosticwhen writing to the subprocess address space.
64443080Scael.Tp Cx Op Ic ?/
64543080Scael.Ic m\ \&
64643080Scael.Ad b1 e1 f1
64743080Scael.Op Ic ?/
64843080Scael.Cx
64919073SmckusickNew values for
65044951Scael.Pf \&( Ad b1 , e1 , f1 )
65119074Smckusickare recorded.  If less than three expressions are given then
65219073Smckusickthe remaining map parameters are left unchanged.
65343080ScaelIf the
65443080Scael.Ic ?
65543080Scaelor
65643080Scael.Ic /
65743080Scaelis followed by
65843080Scael.Li *
65943080Scaelthen
66044951Scaelthe second segment
66144951Scael.Pf \&( Ad b2 , e2 , f2 )
66219073Smckusickof the mapping is changed.
66343080ScaelIf the list is terminated by
66443080Scael.Ic ?
66543080Scaelor
66643080Scael.Ic /
66743080Scaelthen the file
66844951Scael.Pf \&( Ar objfil
66943080Scaelor
67043080Scael.Ar corfil
67119074Smckusickrespectively) is used for subsequent requests.
67243080ScaelFor example,
67344951Scael.Sq Li /m?
67443080Scaelwill cause
67543080Scael.Ic /
67643080Scaelto refer to
67743080Scael.Ar objfil .
67843080Scael.Tp Cx Ic >
67943080Scael.Va name
68043080Scael.Cx
68143080Scael.Ad Dot
68219073Smckusickis assigned to the variable or register named.
68343080Scael.Tp Ic \&!
68443080ScaelA shell
68544951Scael.Pf \&( Pa /bin/sh )
68643080Scaelis called to read the rest of the line following
68743080Scael.Ic \&! .
68843080Scael.Tp Cx Cm $
68943080Scael.Va modifier
69043080Scael.Cx
69143080ScaelMiscellaneous commands.  The available
69243080Scael.Va modifiers
69319073Smckusickare:
69443080Scael.Tw fil
69543080Scael.Tp Cx Cm <
69643080Scael.Va file
69743080Scael.Cx
69843080ScaelRead commands from
69943080Scael.Va file
70019073SmckusickIf this command is executed in a file, further commands
70119073Smckusickin the file are not seen.
70219073SmckusickIf
70343080Scael.Va file
70419074Smckusickis omitted, the current input stream is terminated.  If a
70543080Scael.Va count
70619073Smckusickis given, and is zero, the command will be ignored.
70719073SmckusickThe value of the count will be placed in variable
70843080Scael.Va 9
70919073Smckusickbefore the first command in
71043080Scael.Va file
71119073Smckusickis executed.
71243080Scael.Tp Cx Cm <<
71343080Scael.Va file
71443080Scael.Cx
71519073SmckusickSimilar to
71643080Scael.Cm <
71719073Smckusickexcept it can be used in a file of commands without
71819074Smckusickcausing the file to be closed.  Variable
71943080Scael.Va 9
72019074Smckusickis saved during the execution of this command, and restored when it completes.
72119073SmckusickThere is a (small) finite limit to the number of
72243080Scael.Cm <<
72319073Smckusickfiles that can be open at once.
72443080Scael.Tp Cx Cm >
72543080Scael.Va file
72643080Scael.Cx
72719073SmckusickAppend output to the file
72843080Scael.Va file ,
72919074Smckusickwhich is created if it does not exist.  If
73043080Scael.Va file
73119073Smckusickis omitted, output is returned to the terminal.
73243080Scael.Tp Cx Cm ?
73343080Scael.Va file
73443080Scael.Cx
73519073SmckusickPrint process id, the signal which caused stoppage or termination,
73643080Scaelas well as the registers as
73743080Scael.Ic $r .
73843080ScaelThis is the default if
73943080Scael.Va modifier
74043080Scaelis omitted.
74143080Scael.Tp Cm r
74219074SmckusickPrint the general registers and the instruction addressed by
74343080Scael.Nm pc .
74443080Scael.Ad Dot
74543080Scaelis set to
74643080Scael.Nm pc .
74743080Scael.Tp Cm b
74819074SmckusickPrint all breakpoints and their associated counts and commands.
74943080Scael.Tp Cm c
75019074SmckusickC stack backtrace.  If
75143080Scael.Ad address
75243080Scaelis given then it is taken as the address of the current frame
75319074Smckusickinstead of the contents of the frame\-pointer register.  If
75443080Scael.Cm C
75519074Smckusickis used then the names and (32 bit) values of all automatic
75636569Sbosticand static variables are printed for each active function
75736569Sbostic(this is partially broken; the names are not now available).  If
75843080Scael.Va count
75919073Smckusickis given then only the first
76043080Scael.Va count
76119073Smckusickframes are printed.
76243080Scael.Tp Cm d
76319073SmckusickSet the default radix to
76443080Scael.Ad address
76536569Sbosticand report the new value.  If no
76643080Scael.Ad address
76736569Sbosticis given, the default radix is not changed.
76836569SbosticThe new radix must be between -16 (decimal) and 16 (decimal)
76936569Sbosticand must not be 0, 1, or -1.
77036569SbosticA negative radix implies that numbers printed in that radix
77136569Sbosticwill be treated as signed; otherwise they are treated as unsigned.
77236569SbosticNote that
77343080Scael.Ad address
77419073Smckusickis interpreted in the (old) current radix.
77536569SbosticThus \*(lq10$d\*(rq simply changes the default radix to unsigned.
77636569SbosticTo make signed decimal the default radix, use \*(lq-0t10$d\*(rq.
77743080Scael.Tp Cm e
77819074SmckusickThe names and values of external variables are printed.
77943080Scael.Tp Cm w
78019073SmckusickSet the page width for output to
78143080Scael.Ad address
78219073Smckusick(default 80).
78343080Scael.Tp Cm s
78419073SmckusickSet the limit for symbol matches to
78543080Scael.Ad address
78637343Sbostic(default 1024).
78743080Scael.Tp Cm q
78819073SmckusickExit from
78943080Scael.Nm adb .
79043080Scael.Tp Cm v
79119073SmckusickPrint all non zero variables in octal.
79243080Scael.Tp Cm m
79319073SmckusickPrint the address map.
79443080Scael.Tp Cm p
79544951Scael.Pf \&( Em Kernel debugging )
79643080ScaelChange the current kernel memory mapping to map the designated
79743080Scael.Sy user structure
79819074Smckusickto the address given by the symbol
79943080Scael.Sy _u .
80019074SmckusickThe
80143080Scael.Ad address
80236569Sbosticargument is the address of the user's user page table entries.
80343080Scael.Tp
80443080Scael.Tp Cx Cm :
80543080Scael.Va modifier
80643080Scael.Cx
80719074SmckusickManage a subprocess.  Available modifiers are:
80843080Scael.Tw Ds
80943080Scael.Tp Cx Cm b
81043080Scael.Va c
81143080Scael.Cx
81219073SmckusickSet breakpoint at
81343080Scael.Ad address .
81419073SmckusickThe breakpoint is executed
81543080Scael.Va count\-1
81639406Storektimes before causing a stop,
81739406Storekafter which it stops unconditionally.
81819074SmckusickEach time the breakpoint is encountered the command
81943080Scael.Va c
82019074Smckusickis executed.  If this command is omitted or sets
82143080Scael.Ad dot
82239406Storekto zero, the breakpoint causes a stop immediately,
82339406Storekregardless of any remaining count.
82443080Scael.Tp Cm d
82519073SmckusickDelete breakpoint at
82643080Scael.Ad address .
82743080Scael.Tp Cm D
82836569SbosticDelete all breakpoints.
82943080Scael.Tp Cm r
83019073SmckusickRun
83143080Scael.Ar objfil
83219074Smckusickas a subprocess.  If
83343080Scael.Ad address
83419074Smckusickis given explicitly then the program is entered at this point; otherwise
83519073Smckusickthe program is entered at its standard entry point.
83643080Scael.Va count
83719074Smckusickspecifies how many breakpoints are to be ignored before stopping.
83819074SmckusickArguments to the subprocess may be supplied on the same line as the command.
83919073SmckusickAn argument starting with < or > causes the standard
84019073Smckusickinput or output to be established for the command.
84143080Scael.Tp Cx Cm c
84243080Scael.Va s
84343080Scael.Cx
84419074SmckusickThe subprocess is continued with signal
84543080Scael.Va s
84619073Smckusicksee
84743080Scael.Xr sigvec 2 .
84819073SmckusickIf
84943080Scael.Ad address
85019074Smckusickis given then the subprocess is continued at this address.
85119073SmckusickIf no signal is specified then the signal
85219073Smckusickthat caused the subprocess to stop is sent.
85319074SmckusickBreakpoint skipping is the same as for
85443080Scael.Cm r .
85543080Scael.Tp Cx Cm s
85643080Scael.Va s
85743080Scael.Cx
85819073SmckusickAs for
85943080Scael.Cm c
86019074Smckusickexcept that the subprocess is single stepped
86143080Scael.Va count
86219074Smckusicktimes.  If there is no current subprocess then
86343080Scael.Ar objfil
86419074Smckusickis run as a subprocess as for
86543080Scael.Cm r .
86619073SmckusickIn this case no signal can be sent; the remainder of the line
86719073Smckusickis treated as arguments to the subprocess.
86843080Scael.Tp Cm k
86919073SmckusickThe current subprocess, if any, is terminated.
87043080Scael.Tp
87143080Scael.Tp
87243080Scael.Sh VARIABLES
87343080Scael.Nm Adb
87419073Smckusickprovides a number of variables.
87519073SmckusickNamed variables are set initially by
87643080Scael.Nm adb
87719073Smckusickbut are not used subsequently.
87819074SmckusickNumbered variables are reserved for communication as follows.
87943080Scael.Dw Ds
88043080Scael.Di L
88143080Scael.Dp \&0
88219073SmckusickThe last value printed.
88343080Scael.Dp \&1
88419073SmckusickThe last offset part of an instruction source.
88536569SbosticThis continues up through at most 6 on the VAX.
88636569SbosticFor a three-operand instruction, variable 2 is the second source offset
88736569Sbosticand variable 3 the destination offset part.
88843080Scael.Dp \&9
88919073SmckusickThe count on the last $< or $<< command.
89043080Scael.Dp
89119074SmckusickOn entry the following are set from the system header in the
89243080Scael.Ar corfil .
89319073SmckusickIf
89443080Scael.Ar corfil
89519073Smckusickdoes not appear to be a
89643080Scael.Pa core
89719074Smckusickfile then these values are set from
89843080Scael.Ar objfil .
89943080Scael.Dw Ds
90043080Scael.Di L
90143080Scael.Dp b
90219073SmckusickThe base address of the data segment.
90343080Scael.Dp d
90419073SmckusickThe data segment size.
90543080Scael.Dp e
90619073SmckusickThe entry point.
90743080Scael.Dp m
90819073SmckusickThe `magic' number (0407, 0410 or 0413).
90943080Scael.Dp s
91019073SmckusickThe stack segment size.
91143080Scael.Dp t
91219073SmckusickThe text segment size.
91343080Scael.Sh ADDRESSES
91419073SmckusickThe address in a file associated with
91519074Smckusicka written address is determined by a mapping associated with that file.
91619073SmckusickEach mapping is represented by two triples
91744951Scael.Pf \&( Ad b1 , e1 , f1 )
91819073Smckusickand
91944951Scael.Pf \&( Ad b2 , e2 , f2 )
92019073Smckusickand the
92143080Scael.Ad file
92243080Scael.Ad address
92319073Smckusickcorresponding to a written
92443080Scael.Ad address
92519073Smckusickis calculated as follows.
92643080Scael.Pp
92743080Scael.Ds I
92843080Scael.Cx Ad b1
92943080Scael.Sy \&\*(<=
93043080Scael.Ad address
93143080Scael.Sy <
93243080Scael.Ad e1
93343080Scael.Sy \ \&\(->\ \&
93443080Scael.Ad file address
93543080Scael.Sy =
93643080Scael.Ad address
93743080Scael.Sy +
93843080Scael.Ad f1
93943080Scael.Sy \-
94043080Scael.Ad b1 ,
94143080Scael.Cx \ \&
94243080Scael.Cx otherwise,
94343080Scael.Cx
94443080Scael.De
94543080Scael.Pp
94643080Scael.Ds I
94743080Scael.Cx Ad b2
94843080Scael.Sy \&\*(<=
94943080Scael.Ad address
95043080Scael.Sy <
95143080Scael.Ad e2
95243080Scael.Sy \ \&\(->\ \&
95343080Scael.Ad file address
95443080Scael.Sy =
95543080Scael.Ad address
95643080Scael.Sy +
95743080Scael.Ad f2
95843080Scael.Sy \-
95943080Scael.Ad b2 ,
96043080Scael.Cx
96143080Scael.De
96243080Scael.Pp
96319073Smckusickotherwise, the requested
96443080Scael.Ar address
96519074Smckusickis not legal.  In some cases (e.g. for programs with separated I and D
96619074Smckusickspace) the two segments for a file may overlap.  If a
96743080Scael.Ic ?
96819073Smckusickor
96943080Scael.Ic /
97019073Smckusickis followed by an
97143080Scael.Ic *
97219074Smckusickthen only the second triple is used.
97343080Scael.Pp
97419074SmckusickThe initial setting of both mappings is suitable for normal
97543080Scael.Pa a.out
97619073Smckusickand
97743080Scael.Pa core
97819074Smckusickfiles.  If either file is not of the kind expected then, for that file,
97943080Scael.Ad b1
98043080Scaelis set to
98143080Scael.Li 0 ,
98243080Scael.Ad e1
98319074Smckusickis set to the maximum file size and
98443080Scael.Ad f1
98519073Smckusickis set to 0; in this way the whole
98619073Smckusickfile can be examined with no address translation.
98743080Scael.Pp
98843080Scael.Sh FILES
98943080Scael.Dw a.out
99044951Scael.Di L
99143080Scael.Dp Pa a.out
99243080Scael.Dp Pa core
99343080Scael.Dp
99443080Scael.Sh SEE ALSO
99543080Scael.Xr cc 1 ,
99643080Scael.Xr dbx 1 ,
99743080Scael.Xr ptrace 2 ,
99843080Scael.Xr a.out 5 ,
99943080Scael.Xr core 5
100043080Scael.Sh HISTORY
100143080Scael.Nm Adb
100243080Scaelwas first released with Version 7 AT&T UNIX.  The version
100343080Scaelof
100443080Scael.Nm adb
100543080Scaelthis man page describes
100643080Scaelis descended from the orignial.
100743080Scael.Sh DIAGNOSTICS
100843080Scael.Li `adb'
100943080Scaelwhen there is no current command or format.
101019073SmckusickComments about inaccessible files, syntax errors,
101119073Smckusickabnormal termination of commands, etc.
101219074SmckusickExit status is 0, unless last command failed or returned nonzero status.
101343080Scael.Sh BUGS
101419074SmckusickSince no shell is invoked to interpret the arguments of the
101543080Scael.Ic :r
101619074Smckusickcommand, the customary wild-card and variable expansions cannot occur.
1017