xref: /csrg-svn/old/adb/common_source/adb.1 (revision 66900)
147822Sbostic.\" Copyright (c) 1990 The Regents of the University of California.
247822Sbostic.\" All rights reserved.
319073Smckusick.\"
450807Scael.\" %sccs.include.proprietary.roff%
519073Smckusick.\"
6*66900Sbostic.\"	@(#)adb.1	5.13 (Berkeley) 04/18/94
747822Sbostic.\"
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
1850807Scael.Op Fl I Ns Ar dir
1943080Scael.Op Ar objfil Op Ar corfil
2043080Scael.Sh DESCRIPTION
2143080Scael.Nm Adb
2219073Smckusickis a general purpose debugging program.
2319073SmckusickIt may be used to examine files and to provide
2419074Smckusicka controlled environment for the execution of UNIX programs.
2543080Scael.Pp
2643080Scael.Ar Objfil
2719073Smckusickis normally an executable program file, preferably
2819074Smckusickcontaining a symbol table; if not then the symbolic features of
2943080Scael.Nm adb
3019074Smckusickcannot be used although the file can still be examined.
3119073SmckusickThe default for
3243080Scael.Ar objfil
3319073Smckusickis
3443080Scael.Pa a.out .
3543080Scael.Ar Corfil
3619074Smckusickis assumed to be a core image file produced after executing
3743080Scael.Ar objfil ;
3819073Smckusickthe default for
3943080Scael.Ar corfil
4019073Smckusickis
4143080Scael.Pa core
4243080Scael.Pp
4319073SmckusickRequests to
4443080Scael.Nm adb
4519074Smckusickare read from the standard input and responses are to the standard output.
4619073SmckusickIf the
4743080Scael.Fl w
4819073Smckusickflag is present then both
4943080Scael.Ar objfil
5019073Smckusickand
5143080Scael.Ar corfil
5219074Smckusickare created if necessary and opened for reading and writing
5319073Smckusickso that files can be modified using
5443080Scael.Nm adb .
5543080Scael.Pp
5643080ScaelThe
5743080Scael.Fl k
5843080Scaeloption makes
5943080Scael.Nm adb
6050807Scaeldo
6150807Scael.Ux
6250807Scaelkernel memory
6343080Scaelmapping; it should be used when
6443080Scael.Pa core
6550807Scaelis a
6650807Scael.Ux
6750807Scaelcrash dump
6843080Scaelor
6943080Scael.Pa /dev/mem .
7043080Scael.Pp
7143080ScaelThe
7243080Scael.Fl I
7343080Scaeloption specifies a directory where files to be read
7443080Scaelwith
7544951Scael.Ic $<
7643080Scaelor
7744951Scael.Ic $<<
7843080Scael(see below) will be sought; the default is
7943080Scael.Pa /usr/lib/adb .
8043080Scael.Pp
8143080Scael.Nm Adb
8243080Scaelignores
8343080Scael.Li QUIT ;
8443080Scael.Li INTERRUPT
8543080Scaelcauses return to the next
8643080Scael.Nm adb
8719073Smckusickcommand.
8843080Scael.Pp
8919073SmckusickIn general requests to
9043080Scael.Nm adb
9119073Smckusickare of the form
9250807Scael.Bd -filled -offset indent
9343080Scael.Op Ad address
9443080Scael.Op \&, Va count
9543080Scael.Op Ic command
9643080Scael.Op \&;
9750807Scael.Ed
9843080Scael.Pp
9919073SmckusickIf
10043080Scael.Ad address
10119073Smckusickis present then
10243080Scael.Ad dot
10319073Smckusickis set to
10443080Scael.Ad address .
10519073SmckusickInitially
10643080Scael.Ad dot
10719074Smckusickis set to 0.  For most commands
10843080Scael.Va count
10919074Smckusickspecifies how many times the command will be executed.  The default
11043080Scael.Va count
11119073Smckusickis 1.
11243080Scael.Ad Address
11319073Smckusickand
11443080Scael.Va count
11519073Smckusickare expressions.
11643080Scael.Pp
11719074SmckusickThe interpretation of an address depends on the context it is used in.
11819074SmckusickIf a subprocess is being debugged then addresses are interpreted
11919073Smckusickin the usual way in the address space of the subprocess.
12063647SmckusickIf the operating system is being debugged, either post-mortem or using
12119073Smckusickthe special file
12243080Scael.Pa /dev/mem
12337104Sjakto interactively examine and/or modify memory, the maps are set to map
12443080Scaelthe kernel virtual addresses which start at
12543080Scael.Li \&0x80000000
12643080Scael(on the VAX); see ADDRESSES below.
12743080Scael.Sh EXPRESSIONS
12850807Scael.Bl -tag -width integer
12950807Scael.It Sy \&\.
13019073SmckusickThe value of
13143080Scael.Ad dot .
13250807Scael.It  Sy \&\+
13319073SmckusickThe value of
13443080Scael.Ad dot
13519073Smckusickincremented by the current increment.
13650807Scael.It Sy \&^
13719073SmckusickThe value of
13843080Scael.Ad dot
13919073Smckusickdecremented by the current increment.
14050807Scael.It Sy \&"
14119073SmckusickThe last
14243080Scael.Ad address
14319073Smckusicktyped.
14450807Scael.It Va integer
14543080ScaelA number.  The prefixes
14643080Scael.Li \&0o
14743080Scaeland
14843080Scael.Li \&0O
14943080Scael(\*(lqzero oh\*(rq)
15043080Scaelforce interpretation
15143080Scaelin octal radix; the prefixes
15243080Scael.Li 0t
15343080Scaeland
15443080Scael.Li 0T
15543080Scaelforce interpretation in
15643080Scaeldecimal radix; the prefixes
15743080Scael.Li 0x
15843080Scaeland
15943080Scael.Li 0X
16043080Scaelforce interpretation in
16143080Scaelhexadecimal radix.  Thus
16243080Scael.Li 0o20
16343080Scael=
16443080Scael.Li 0t16
16543080Scael=
16643080Scael.Li 0x10
16743080Scael= sixteen.
16819073SmckusickIf no prefix appears, then the
16943080Scael.Em default radix
17043080Scaelis used; see the
17144951Scael.Ic $d
17243080Scaelcommand.  The default radix is initially hexadecimal.
17343080ScaelThe hexadecimal digits are
17443080Scael.Li 0123456789abcdefABCDEF
17543080Scaelwith the obvious
17619073Smckusickvalues.  Note that a hexadecimal number whose most significant
17743080Scaeldigit would otherwise be an alphabetic character must have a
17843080Scael.Li 0x
17943080Scael(or
18043080Scael.Li 0X )
18143080Scaelprefix (or a leading zero if the default radix is hexadecimal).
18250807Scael.It Va integer.fraction
18319073SmckusickA 32 bit floating point number.
18450807Scael.It Li \'cccc\'
18519073SmckusickThe ASCII value of up to 4 characters.
18643080Scael.Li \e
18743080Scaelmay be used to escape a
18843080Scael.Li \' .
18950807Scael.It Va < name
19019073SmckusickThe value of
19143080Scael.Va name ,
19219073Smckusickwhich is either a variable name or a register name.
19343080Scael.Nm Adb
19419074Smckusickmaintains a number of variables (see
19550807Scael.Sx VARIABLES
19650807Scaelbelow)
19719073Smckusicknamed by single letters or digits.
19819073SmckusickIf
19943080Scael.Va name
20019074Smckusickis a register name then the value of the register is obtained from
20119073Smckusickthe system header in
20243080Scael.Ar corfil .
20343080ScaelThe register names are those printed by the
20444951Scael.Ic $r
20543080Scaelcommand.
20650807Scael.It Va symbol
20719073SmckusickA
20843080Scael.Va symbol
20919074Smckusickis a sequence of upper or lower case letters, underscores or
21019074Smckusickdigits, not starting with a digit.  The backslash character
21143080Scael.Li \e
21219074Smckusickmay be used to escape other characters.  The value of the
21343080Scael.Va symbol
21419074Smckusickis taken from the symbol table in
21543080Scael.Ar objfil .
21643080ScaelAn initial
21743080Scael.Li \_
21843080Scaelwill be prepended to
21943080Scael.Va symbol
22019073Smckusickif needed.
22150807Scael.It Va _symbol
22243080ScaelIn C, the `true name' of an external symbol begins with
22343080Scael.Li \_ .
22419074SmckusickIt may be necessary to utter this name to distinguish it
22519073Smckusickfrom internal or hidden variables of a program.
22650807Scael.It Va routine.name
22719073SmckusickThe address of the variable
22843080Scael.Va name
22919074Smckusickin the specified C routine.  Both
23043080Scael.Va routine
23119073Smckusickand
23243080Scael.Va name
23319073Smckusickare
23443080Scael.Va symbols .
23519073SmckusickIf
23643080Scael.Va routine
23736569Sbosticis omitted, the currently active frame is used.
23836569Sbostic(This form is currently broken; local variables can be examined
23936569Sbosticonly with
24043080Scael.Xr dbx 1 ) .
24136569SbosticIf
24243080Scael.Va name
24336569Sbosticis omitted the value is the address
24436569Sbosticof the most recently activated C stack frame
24519073Smckusickcorresponding to
24643080Scael.Va routine
24736569Sbostic(this much works).
24850807Scael.It Pq Va exp
24919073SmckusickThe value of the expression
25050807Scael.Ar exp .
25150807Scael.El
25243080Scael.Ss Monadic Operators
25350807Scael.Bl -tag -width flag -compact
25450807Scael.It Li \&* Ns Va exp
25519074SmckusickThe contents of the location addressed by
25643080Scael.Va exp
25719073Smckusickin
25843080Scael.Ar corfil .
25950807Scael.It Li \&@ Ns Va exp
26019073SmckusickThe contents of the location addressed by
26143080Scael.Va exp
26219073Smckusickin
26343080Scael.Ar objfil .
26450807Scael.It Li \&\- Ns Va exp
26519073SmckusickInteger negation.
26650807Scael.It Li \&~ Ns Va exp
26719073SmckusickBitwise complement.
26850807Scael.It Li \&# Ns Va exp
26919073SmckusickLogical negation.
27050807Scael.El
27143080Scael.Ss Dyadic operators
27250807ScaelAre left associative and are less binding than monadic operators.
27350807Scael.Pp
27450807Scael.Bl -tag -width xxXxx -compact
27550807Scael.It Va e1 Ns Li \&\+ Ns Va e2
27619073SmckusickInteger addition.
27750807Scael.It Va e1 Ns Li \&\- Ns Va e2
27819073SmckusickInteger subtraction.
27950807Scael.It Va e1 Ns Li \&* Ns Va e2
28019073SmckusickInteger multiplication.
28150807Scael.It Va e1 Ns Li \&% Ns Va e2
28219073SmckusickInteger division.
28350807Scael.It Va e1 Ns Li & Ns Va e2
28419073SmckusickBitwise conjunction.
28550807Scael.It Va e1 Ns Li \&| Ns Va e2
28619073SmckusickBitwise disjunction.
28750807Scael.It Va e1 Ns Li # Ns Va e2
28863647Smckusick.Va e1
28919073Smckusickrounded up to the next multiple of
29043080Scael.Va e2 .
29150807Scael.El
29243080Scael.Sh COMMANDS
29319074SmckusickMost commands consist of a verb followed by a modifier or list of modifiers.
29419073SmckusickThe following verbs are available.
29543080Scael(The commands
29643080Scael.Ic ?
29743080Scaeland
29843080Scael.Li /
29943080Scaelmay be followed by
30043080Scael.Li * ;
30143080Scaelsee the
30250807Scael.Sx ADDRESSES
30350807Scaelsection
30419073Smckusickfor further details.)
30550807Scael.Bl -tag -width flag
30650807Scael.It Ic ? Ns Va f
30719073SmckusickLocations starting at
30843080Scael.Ad address
30919073Smckusickin
31043080Scael.Ar objfil
31119073Smckusickare printed according to the format
31243080Scael.Va f .
31343080Scael.Ad dot
31419073Smckusickis incremented by the sum of the increments for each format letter (q.v.).
31550807Scael.It Ic / Ns Va f
31619073SmckusickLocations starting at
31743080Scael.Ad address
31819073Smckusickin
31943080Scael.Ar corfil
32019073Smckusickare printed according to the format
32143080Scael.Va f
32219073Smckusickand
32343080Scael.Ad dot
32443080Scaelis incremented as for
32543080Scael.Ic ? .
32650807Scael.It Ic = Ns Va f
32719073SmckusickThe value of
32843080Scael.Ad address
32919074Smckusickitself is printed in the styles indicated by the format
33043080Scael.Va f .
33119073Smckusick(For
33243080Scael.Va i
33363647Smckusickformat, zero values are assumed
33436569Sbosticfor the parts of the instruction that reference
33519073Smckusicksubsequent words.)
33650807Scael.El
33743080Scael.Pp
33819073SmckusickA
33943080Scael.Va format
34019074Smckusickconsists of one or more characters that specify a style of printing.
34119073SmckusickEach format character may be preceded by a decimal integer
34219073Smckusickthat is a repeat count for the format character.
34363647SmckusickWhile stepping through a format,
34443080Scael.Ad dot
34519074Smckusickis incremented by the amount given for each format letter.
34619073SmckusickIf no format is given then the last format is used.
34736569SbosticThe format characters available are as follows.
34843080ScaelNote that a backslash
34950807Scael.Pq Li \e
35043080Scaelmust be used
35136569Sbosticto quote the three numeric formats.
35250807Scael.Pp
35350807Scael.Bl -tag -width \&M_____\&M -compact
35450807Scael.It Ic 1 Va 1
35536569SbosticPrint 1 byte in the current radix
35643080Scael(which may be either signed or unsigned; see the
35744951Scael.Ic $d
35843080Scaelcommand).
35950807Scael.It Ic 2 Va 2
36036569SbosticPrint 2 bytes in the current radix.
36150807Scael.It Ic 4 Va 4
36236569SbosticPrint 4 bytes in the current radix.
36350807Scael.It Ic v Va 2
36436569SbosticPrint 2 bytes in the signed variant of the current radix.
36550807Scael.It Ic V Va 4
36636569SbosticPrint 4 bytes in the signed variant of the current radix.
36750807Scael.It Ic o Va 2
36836569SbosticPrint 2 bytes in unsigned octal.  All octal numbers output by
36943080Scael.Nm adb
37036569Sbosticare preceded by 0.
37150807Scael.It Ic O Va 4
37236569SbosticPrint 4 bytes in unsigned octal.
37350807Scael.It Ic q Va 2
37436569SbosticPrint 2 bytes in signed octal.
37550807Scael.It Ic Q Va 4
37636569SbosticPrint 4 bytes in signed octal.
37750807Scael.It Ic u Va 2
37836569SbosticPrint 2 bytes in unsigned decimal.
37950807Scael.It Ic U Va 4
38036569SbosticPrint 4 bytes in long unsigned decimal.
38150807Scael.It Ic d Va 2
38236569SbosticPrint 2 bytes in signed decimal.
38350807Scael.It Ic D Va 4
38436569SbosticPrint 4 bytes in long signed decimal.
38550807Scael.It Ic x Va 2
38636569SbosticPrint 2 bytes in unsigned hexadecimal.
38750807Scael.It Ic X Va 4
38836569SbosticPrint 4 bytes in unsigned hexadecimal.
38950807Scael.It Ic z Va 2
39036569SbosticPrint 2 bytes in signed hexadecimal.
39150807Scael.It Ic Z Va 4
39236569SbosticPrint 4 bytes in signed hexadecimal.
39350807Scael.It Ic f Va 4
39436569SbosticPrint 4 bytes as a floating point number.
39550807Scael.It Ic F Va 8
39663647SmckusickPrint 8 bytes as a double precision floating point number.
39750807Scael.It Ic b Va 1
39836569SbosticPrint 1 byte in unsigned octal.
39950807Scael.It Ic c Va 1
40036569SbosticPrint 1 byte as a character.
40150807Scael.It Ic C Va 1
40236569SbosticPrint 1 byte as a character, using
40319073Smckusickthe standard escape convention where control characters
40444951Scaelare printed as
40550807Scael.Ql \&^X
40650807Scaeland the delete character is printed as
40750807Scael.Ql ^? .
40850807Scael.It Ic s Va n
40919074SmckusickPrint the addressed characters until a zero character is reached.
41063647Smckusick.Ar n
41163647Smckusickis the length of the string including its zero terminator.
41250807Scael.It Ic S Va n
41344951ScaelPrint a string using the
41450807Scael.Ql ^X
41543080Scaelescape convention (see
41643080Scael.Ar C
41743080Scaelabove).
41843080Scael.Ar n
41919073Smckusickis the length of the string including its zero terminator.
42050807Scael.It Ic Y Va 4
42119073SmckusickPrint 4 bytes in date format (see
42243080Scael.Xr ctime 3 ) .
42350807Scael.It Ic i Va n
42419074SmckusickPrint as machine instructions.
42543080Scael.Ar n
42619073Smckusickis the number of bytes occupied by the instruction.
42736569SbosticThis style of printing causes the numeric variables 1, 2, ... to be set
42836569Sbosticaccording to the offset parts of the arguments, if any, of the instruction
42950807Scael(up to 6 on the
43050807Scael.Tn VAX ) .
43150807Scael.It Ic a Va 0
43219073SmckusickPrint the value of
43343080Scael.Ad dot
43419073Smckusickin symbolic form.
43519073SmckusickSymbols are checked to ensure that they have an appropriate
43619073Smckusicktype as indicated below.
43750807Scael.Bl -tag -width flag -compact
43850807Scael.It Va /
43943080Scaellocal or global data symbol
44050807Scael.It Va \&?
44143080Scaellocal or global text symbol
44250807Scael.It Va \&=
44343080Scaellocal or global absolute symbol
44450807Scael.El
44550807Scael.It Ic p Va 4
44619073SmckusickPrint the addressed value in symbolic form using
44719073Smckusickthe same rules for symbol lookup as
44843080Scael.Ic a .
44950807Scael.It Ic t Va 0
45063647SmckusickWhen preceded by an integer, tabs to the next appropriate tab stop.
45119073SmckusickFor example,
45243080Scael.Li 8t
45319073Smckusickmoves to the next 8-space tab stop.
45450807Scael.It Ic r Va 0
45519073SmckusickPrint a space.
45650807Scael.It Ic n Va 0
45719073SmckusickPrint a newline.
45863647Smckusick.ne 2v
45950807Scael.It Ic \*(Lq...\*(Rq Va 0
46019073SmckusickPrint the enclosed string.
46150807Scael.It Ic \&^
46243080Scael.Ad Dot
46319074Smckusickis decremented by the current increment.  Nothing is printed.
46450807Scael.It Ic \&+
46543080Scael.Ad Dot
46619074Smckusickis incremented by 1.  Nothing is printed.
46750807Scael.It Ic \&\-
46843080Scael.Ad Dot
46919074Smckusickis decremented by 1.  Nothing is printed.
47050807Scael.It newline
47119073SmckusickRepeat the previous command with a
47243080Scael.Va count
47319073Smckusickof 1.
47450807Scael.El
47543080Scael.Pp
47650807Scael.Bl -tag -width $modifier
47750807Scael.It Xo
47850807Scael.Oo Ic ?/ Oc Ns Ic l
47950807Scael.Va "value mask"
48050807Scael.Xc
48119073SmckusickWords starting at
48243080Scael.Ad dot
48319073Smckusickare masked with
48443080Scael.Va mask
48543080Scaeland
48643080Scaelcompared with
48743080Scael.Va value
48819074Smckusickuntil a match is found.
48919073SmckusickIf
49043080Scael.Cm L
49119073Smckusickis used then the match is for 4 bytes at a time instead of 2.
49219073SmckusickIf no match is found then
49343080Scael.Ad dot
49419073Smckusickis unchanged; otherwise
49543080Scael.Ad dot
49619073Smckusickis set to the matched location.
49719073SmckusickIf
49843080Scael.Va mask
49936569Sbosticis omitted then all bits are compared.
50050807Scael.It Xo
50150807Scael.Oo Ic ?/ Oc Ns Ic w
50250807Scael.Va "value ..."
50350807Scael.Xc
50419073SmckusickWrite the 2-byte
50543080Scael.Va value
50619074Smckusickinto the addressed location.  If the command is
50743080Scael.Ic W ,
50819073Smckusickwrite 4 bytes.
50943080ScaelOdd addresses
51043080Scael.Em are
51143080Scaelallowed
51236569Sbosticwhen writing to the subprocess address space.
51350807Scael.It Xo
51450807Scael.Oo Ic ?/ Oc Ns Ic m
51550807Scael.Ad b1 e1 f1 Ns Op Ic ?/
51650807Scael.Xc
51719073SmckusickNew values for
51850807Scael.Pq Ad b1 , e1 , f1
51919074Smckusickare recorded.  If less than three expressions are given then
52019073Smckusickthe remaining map parameters are left unchanged.
52143080ScaelIf the
52243080Scael.Ic ?
52343080Scaelor
52443080Scael.Ic /
52543080Scaelis followed by
52643080Scael.Li *
52743080Scaelthen
52844951Scaelthe second segment
52950807Scael.Pq Ad b2 , e2 , f2
53019073Smckusickof the mapping is changed.
53143080ScaelIf the list is terminated by
53243080Scael.Ic ?
53343080Scaelor
53443080Scael.Ic /
53543080Scaelthen the file
53650807Scael.Pf ( Ar objfil
53743080Scaelor
53843080Scael.Ar corfil
53919074Smckusickrespectively) is used for subsequent requests.
54043080ScaelFor example,
54144951Scael.Sq Li /m?
54243080Scaelwill cause
54343080Scael.Ic /
54443080Scaelto refer to
54543080Scael.Ar objfil .
54650807Scael.It Ic > Ns Va name
54743080Scael.Ad Dot
54819073Smckusickis assigned to the variable or register named.
54950807Scael.It Ic \&!
55043080ScaelA shell
55150807Scael.Pq Pa /bin/sh
55243080Scaelis called to read the rest of the line following
55343080Scael.Ic \&! .
55450807Scael.It Cm $ Ns Va modifier
55543080ScaelMiscellaneous commands.  The available
55643080Scael.Va modifiers
55719073Smckusickare:
55850807Scael.Bl -tag -width filexx
55950807Scael.It Cm < Ns Va file
56043080ScaelRead commands from
56163647Smckusick.Va file .
56219073SmckusickIf this command is executed in a file, further commands
56319073Smckusickin the file are not seen.
56419073SmckusickIf
56543080Scael.Va file
56619074Smckusickis omitted, the current input stream is terminated.  If a
56743080Scael.Va count
56819073Smckusickis given, and is zero, the command will be ignored.
56919073SmckusickThe value of the count will be placed in variable
57043080Scael.Va 9
57119073Smckusickbefore the first command in
57243080Scael.Va file
57319073Smckusickis executed.
57450807Scael.It Cm << Ns Va file
57519073SmckusickSimilar to
57643080Scael.Cm <
57719073Smckusickexcept it can be used in a file of commands without
57819074Smckusickcausing the file to be closed.  Variable
57943080Scael.Va 9
58019074Smckusickis saved during the execution of this command, and restored when it completes.
58119073SmckusickThere is a (small) finite limit to the number of
58243080Scael.Cm <<
58319073Smckusickfiles that can be open at once.
58450807Scael.It Cm > Ns Va file
58519073SmckusickAppend output to the file
58643080Scael.Va file ,
58719074Smckusickwhich is created if it does not exist.  If
58843080Scael.Va file
58919073Smckusickis omitted, output is returned to the terminal.
59050807Scael.It Cm ? Ns Va file
59119073SmckusickPrint process id, the signal which caused stoppage or termination,
59243080Scaelas well as the registers as
59343080Scael.Ic $r .
59443080ScaelThis is the default if
59543080Scael.Va modifier
59643080Scaelis omitted.
59750807Scael.It Cm r
59819074SmckusickPrint the general registers and the instruction addressed by
59943080Scael.Nm pc .
60043080Scael.Ad Dot
60143080Scaelis set to
60243080Scael.Nm pc .
60350807Scael.It Cm b
60419074SmckusickPrint all breakpoints and their associated counts and commands.
60550807Scael.It Cm c
60619074SmckusickC stack backtrace.  If
60743080Scael.Ad address
60843080Scaelis given then it is taken as the address of the current frame
60919074Smckusickinstead of the contents of the frame\-pointer register.  If
61043080Scael.Cm C
61119074Smckusickis used then the names and (32 bit) values of all automatic
61236569Sbosticand static variables are printed for each active function
61336569Sbostic(this is partially broken; the names are not now available).  If
61443080Scael.Va count
61519073Smckusickis given then only the first
61643080Scael.Va count
61719073Smckusickframes are printed.
61850807Scael.It Cm d
61919073SmckusickSet the default radix to
62043080Scael.Ad address
62136569Sbosticand report the new value.  If no
62243080Scael.Ad address
62336569Sbosticis given, the default radix is not changed.
62436569SbosticThe new radix must be between -16 (decimal) and 16 (decimal)
62536569Sbosticand must not be 0, 1, or -1.
62636569SbosticA negative radix implies that numbers printed in that radix
62736569Sbosticwill be treated as signed; otherwise they are treated as unsigned.
62836569SbosticNote that
62943080Scael.Ad address
63019073Smckusickis interpreted in the (old) current radix.
63150807ScaelThus
63250807Scael.Dq "10$d"
63350807Scaelsimply changes the default radix to unsigned.
63450807ScaelTo make signed decimal the default radix, use
63550807Scael.Dq "-0t10$d"
63650807Scael.It Cm e
63719074SmckusickThe names and values of external variables are printed.
63850807Scael.It Cm w
63919073SmckusickSet the page width for output to
64043080Scael.Ad address
64119073Smckusick(default 80).
64250807Scael.It Cm s
64319073SmckusickSet the limit for symbol matches to
64443080Scael.Ad address
64537343Sbostic(default 1024).
64650807Scael.It Cm q
64719073SmckusickExit from
64843080Scael.Nm adb .
64950807Scael.It Cm v
65019073SmckusickPrint all non zero variables in octal.
65150807Scael.It Cm m
65219073SmckusickPrint the address map.
65350807Scael.It Cm p
65450807Scael.Pq Em Kernel debugging
65543080ScaelChange the current kernel memory mapping to map the designated
65643080Scael.Sy user structure
65719074Smckusickto the address given by the symbol
65843080Scael.Sy _u .
65919074SmckusickThe
66043080Scael.Ad address
66136569Sbosticargument is the address of the user's user page table entries.
66250807Scael.El
66350807Scael.It Cm : Ns Va modifier
66419074SmckusickManage a subprocess.  Available modifiers are:
66550807Scael.Bl -tag -width Ds
66650807Scael.It Cm b Ns Va c
66719073SmckusickSet breakpoint at
66843080Scael.Ad address .
66919073SmckusickThe breakpoint is executed
67043080Scael.Va count\-1
67139406Storektimes before causing a stop,
67239406Storekafter which it stops unconditionally.
67319074SmckusickEach time the breakpoint is encountered the command
67443080Scael.Va c
67519074Smckusickis executed.  If this command is omitted or sets
67643080Scael.Ad dot
67739406Storekto zero, the breakpoint causes a stop immediately,
67839406Storekregardless of any remaining count.
67950807Scael.It Cm d
68019073SmckusickDelete breakpoint at
68143080Scael.Ad address .
68250807Scael.It Cm D
68336569SbosticDelete all breakpoints.
68450807Scael.It Cm r
68519073SmckusickRun
68643080Scael.Ar objfil
68719074Smckusickas a subprocess.  If
68843080Scael.Ad address
68919074Smckusickis given explicitly then the program is entered at this point; otherwise
69019073Smckusickthe program is entered at its standard entry point.
69143080Scael.Va count
69219074Smckusickspecifies how many breakpoints are to be ignored before stopping.
69319074SmckusickArguments to the subprocess may be supplied on the same line as the command.
69419073SmckusickAn argument starting with < or > causes the standard
69519073Smckusickinput or output to be established for the command.
69650807Scael.It Cm c Ns Va s
69719074SmckusickThe subprocess is continued with signal
69863647Smckusick.Va s ;
69919073Smckusicksee
70043080Scael.Xr sigvec 2 .
70119073SmckusickIf
70243080Scael.Ad address
70319074Smckusickis given then the subprocess is continued at this address.
70419073SmckusickIf no signal is specified then the signal
70519073Smckusickthat caused the subprocess to stop is sent.
70619074SmckusickBreakpoint skipping is the same as for
70743080Scael.Cm r .
70850807Scael.It Cm s Ns Va s
70919073SmckusickAs for
71043080Scael.Cm c
71119074Smckusickexcept that the subprocess is single stepped
71243080Scael.Va count
71319074Smckusicktimes.  If there is no current subprocess then
71443080Scael.Ar objfil
71519074Smckusickis run as a subprocess as for
71643080Scael.Cm r .
71719073SmckusickIn this case no signal can be sent; the remainder of the line
71819073Smckusickis treated as arguments to the subprocess.
71950807Scael.It Cm k
72019073SmckusickThe current subprocess, if any, is terminated.
72150807Scael.El
72250807Scael.El
72343080Scael.Sh VARIABLES
72443080Scael.Nm Adb
72519073Smckusickprovides a number of variables.
72619073SmckusickNamed variables are set initially by
72743080Scael.Nm adb
72819073Smckusickbut are not used subsequently.
72919074SmckusickNumbered variables are reserved for communication as follows.
73050807Scael.Pp
73150807Scael.Bl -tag -width Ds -compact
73250807Scael.It \&0
73319073SmckusickThe last value printed.
73450807Scael.It \&1
73519073SmckusickThe last offset part of an instruction source.
73650807ScaelThis continues up through at most 6 on the
73750807Scael.Tn VAX .
73836569SbosticFor a three-operand instruction, variable 2 is the second source offset
73936569Sbosticand variable 3 the destination offset part.
74050807Scael.It \&9
74119073SmckusickThe count on the last $< or $<< command.
74250807Scael.El
74350807Scael.Pp
74419074SmckusickOn entry the following are set from the system header in the
74543080Scael.Ar corfil .
74619073SmckusickIf
74743080Scael.Ar corfil
74819073Smckusickdoes not appear to be a
74943080Scael.Pa core
75019074Smckusickfile then these values are set from
75143080Scael.Ar objfil .
75250807Scael.Pp
75350807Scael.Bl -tag -width Ds -compact
75450807Scael.It b
75519073SmckusickThe base address of the data segment.
75650807Scael.It d
75719073SmckusickThe data segment size.
75850807Scael.It e
75919073SmckusickThe entry point.
76050807Scael.It m
76119073SmckusickThe `magic' number (0407, 0410 or 0413).
76250807Scael.It s
76319073SmckusickThe stack segment size.
76450807Scael.It t
76519073SmckusickThe text segment size.
76643080Scael.Sh ADDRESSES
76719073SmckusickThe address in a file associated with
76819074Smckusicka written address is determined by a mapping associated with that file.
76919073SmckusickEach mapping is represented by two triples
77050807Scael.Pq Ad b1 , e1 , f1
77119073Smckusickand
77250807Scael.Pq Ad b2 , e2 , f2
77319073Smckusickand the
77443080Scael.Ad file
77543080Scael.Ad address
77619073Smckusickcorresponding to a written
77743080Scael.Ad address
77819073Smckusickis calculated as follows.
77950807Scael.Bd -filled -offset indent
78063647Smckusick\*(aDb1\*(sY\*(<=\*(aRaddress\*(<=\*(aDe1 \*(sY\(->
78163647Smckusick\*(aRfile address\*(dF=\*(aRaddress\*(sY+\*(aDf1\*(sY-\*(aDb1,
78250807Scaelotherwise
78350807Scael.Ed
78443080Scael.Pp
78550807Scael.Bd -filled -offset indent
78663647Smckusick\*(aDb2\*(sY\*(<=\*(aRaddress\*(<=\*(aDe2 \*(sY\(->
78763647Smckusick\*(aRfile address\*(dF=\*(aRaddress\*(sY+\*(aDf2\*(sY-\*(aDb2\*(dF
78850807Scael.Ed
78943080Scael.Pp
79019073Smckusickotherwise, the requested
79143080Scael.Ar address
79219074Smckusickis not legal.  In some cases (e.g. for programs with separated I and D
79319074Smckusickspace) the two segments for a file may overlap.  If a
79443080Scael.Ic ?
79519073Smckusickor
79643080Scael.Ic /
79719073Smckusickis followed by an
79843080Scael.Ic *
79919074Smckusickthen only the second triple is used.
80043080Scael.Pp
80119074SmckusickThe initial setting of both mappings is suitable for normal
80243080Scael.Pa a.out
80319073Smckusickand
80443080Scael.Pa core
80519074Smckusickfiles.  If either file is not of the kind expected then, for that file,
80643080Scael.Ad b1
80743080Scaelis set to
80843080Scael.Li 0 ,
80943080Scael.Ad e1
81019074Smckusickis set to the maximum file size and
81143080Scael.Ad f1
81219073Smckusickis set to 0; in this way the whole
81319073Smckusickfile can be examined with no address translation.
81443080Scael.Sh FILES
81550807Scael.Bl -tag -width a.out -compact
81650807Scael.It Pa a.out
81750807Scael.It Pa core
81850807Scael.El
81943080Scael.Sh SEE ALSO
82043080Scael.Xr cc 1 ,
82143080Scael.Xr dbx 1 ,
82243080Scael.Xr ptrace 2 ,
82343080Scael.Xr a.out 5 ,
82443080Scael.Xr core 5
82543080Scael.Sh HISTORY
82643080Scael.Nm Adb
82750807Scaelwas first released with
82850807Scael.At v7 .
82950807ScaelThe version
83043080Scaelof
83143080Scael.Nm adb
83243080Scaelthis man page describes
833*66900Sbosticis descended from the original.
83443080Scael.Sh DIAGNOSTICS
83543080Scael.Li `adb'
83643080Scaelwhen there is no current command or format.
83719073SmckusickComments about inaccessible files, syntax errors,
83819073Smckusickabnormal termination of commands, etc.
83919074SmckusickExit status is 0, unless last command failed or returned nonzero status.
84043080Scael.Sh BUGS
84119074SmckusickSince no shell is invoked to interpret the arguments of the
84243080Scael.Ic :r
84319074Smckusickcommand, the customary wild-card and variable expansions cannot occur.
844