xref: /csrg-svn/old/dbx/dbx.1 (revision 44953)
143083Scael.\" Copyright (c) 1983, 1990 The Regents of the University of California.
238105Sbostic.\" All rights reserved.
319716Smckusick.\"
443083Scael.\" %sccs.include.redist.man%
519716Smckusick.\"
6*44953Scael.\"     @(#)dbx.1	6.5 (Berkeley) 07/24/90
738105Sbostic.\"
843083Scael.Dd
943083Scael.Dt DBX 1
1043083Scael.Os BSD 4.2
1143083Scael.Sh NAME
1243083Scael.Nm dbx
1343083Scael.Nd debugger
1443083Scael.Sh SYNOPSIS
1543083Scael.Nm Dbx
1643083Scael.Op Fl r
1743083Scael.Op Fl i
1843083Scael.Op Fl k
1943083Scael.Op Fl I Ar dir
2043083Scael.Op Fl c Ar file
2143083Scael.Op Ar objfile Op Ar coredump
2243083Scael.Sh DESCRIPTION
23*44953Scael.Nm Dbx
2443083Scaelis a tool for source level debugging and execution of
2519716Smckusickprograms under UNIX.
2643083ScaelThe
2743083Scael.Ar objfile
2843083Scaelis an object file produced by a compiler
2943083Scaelwith the appropriate flag (usually
3043083Scael.Fl g )
3119716Smckusickspecified to produce symbol information in the object file.
3243083ScaelCurrently,
3343083Scael.Xr cc 1 ,
3443083Scael.Xr f77 1 ,
3543083Scael.Xr pc 1 ,
3643083Scaeland the DEC Western
3743083ScaelResearch Laboratory Modula-2 compiler,
3843083Scael.Xr mod l ,
3919720Smckusickproduce the appropriate source information.
4043083ScaelThe machine level facilities of
4143083Scael.Nm dbx
4219716Smckusickcan be used on any program.
4343083Scael.Pp
44*44953ScaelThe object file contains a symbol table that includes the names of
4519716Smckusickall the source files translated by the compiler to create it.
4619716SmckusickThese files are available for perusal while using the debugger.
4743083Scael.Pp
48*44953ScaelIf a file named
49*44953Scael.Pa core
5043083Scaelexists in the current directory
5143083Scaelor a
5243083Scael.Ar coredump
5343083Scaelfile is specified,
5443083Scael.Nm dbx
5543083Scaelcan be used
5619716Smckusickto examine the state of the program when it faulted.
5743083Scael.Pp
58*44953ScaelIf the file
59*44953Scael.Pa .dbxinit
60*44953Scaelexists in the current directory then the
6119716Smckusickdebugger commands in it are executed.
6243083Scael.Nm Dbx
63*44953Scaelalso checks for a
64*44953Scael.Pa .dbxinit
65*44953Scaelin the user's home directory
6619716Smckusickif there isn't one in the current directory.
6743083Scael.Pp
6819716SmckusickThe command line options and their meanings are:
6943083Scael.Tw Fl
7043083Scael.Tp Fl r
7143083ScaelExecute
7243083Scael.Ar objfile
7343083Scaelimmediately.
7443083ScaelIf it terminates successfully
7543083Scael.Nm dbx
7643083Scaelexits.
7719716SmckusickOtherwise the reason for termination will be reported
7819716Smckusickand the user offered the option of entering the debugger
7919716Smckusickor letting the program fault.
8043083Scael.Nm Dbx
81*44953Scaelwill read from
82*44953Scael.Pa /dev/tty
83*44953Scaelwhen
8443083Scael.Fl r
8543083Scaelis specified
8619716Smckusickand standard input is not a terminal.
8743083Scael.Tp Fl i
8843083ScaelForce
8943083Scael.Nm dbx
9043083Scaelto act as though standard input is a terminal.
9143083Scael.Tp Fl k
9219720SmckusickMap memory addresses, useful for kernel debugging.
9343083Scael.Tp Cx Fl I
9443083Scael.Cx \&\ \&
9543083Scael.Ar dir
9643083Scael.Cx
9743083ScaelAdd
9843083Scael.Ar dir
9943083Scaelto the list of directories
10019716Smckusickthat are searched when looking for a source file.
10143083ScaelNormally
10243083Scael.Nm dbx
10343083Scaellooks for source files in the current directory
10443083Scaeland in the directory where
10543083Scael.Ar objfile
10643083Scaelis located.
10743083ScaelThe directory search path can also be set with the
108*44953Scael.Ic use
10943083Scaelcommand.
11043083Scael.Tp Cx Fl c
11143083Scael.Cx \&\ \&
11243083Scael.Ar file
11343083Scael.Cx
11443083ScaelExecute the
11543083Scael.Nm dbx
11643083Scaelcommands in the
11743083Scael.Ar file
11843083Scaelbefore
11919720Smckusickreading from standard input.
12043083Scael.Tp
12143083Scael.Pp
12243083ScaelUnless
12343083Scael.Fl r
12443083Scaelis specified,
12543083Scael.Nm dbx
12643083Scaeljust prompts and waits for a command.
12743083Scael.Ss Execution and Tracing Commands
12843083Scael.Dw Fl
12943083Scael.Di L
13043083Scael.Dp Cx Ic run
13143083Scael.Cx \&\ \&
13243083Scael.Op Ar args
13343083Scael.Cx \&\ \&
13443083Scael.Op Sy < Ar filename
13543083Scael.Cx \&\ \&
13643083Scael.Op Sy > Ar filename
13743083Scael.Cx
13843083Scael.Dp Cx Ic rerun
13943083Scael.Cx \&\ \&
14043083Scael.Op Ar args
14143083Scael.Cx \&\ \&
14243083Scael.Op Sy < Ar filename
14343083Scael.Cx \&\ \&
14443083Scael.Op Sy > Ar filename
14543083Scael.Cx
14643083ScaelStart executing
14743083Scael.Ar objfile  ,
14843083Scaelpassing
14943083Scael.Ar args
15043083Scaelas command line arguments;
15143083Scael.Sy <
15243083Scaelor
15343083Scael.Sy >
15443083Scaelcan be used to redirect input or output in the usual manner.
15543083ScaelWhen
15643083Scael.Ic rerun
15743083Scaelis used without any arguments the previous
15819720Smckusickargument list is passed to the program;
15943083Scaelotherwise it is identical to
16043083Scael.Ic run .
16143083ScaelIf
16243083Scael.Ar objfile
16343083Scaelhas been written since the last time the symbolic information
16443083Scaelwas read in,
16543083Scael.Nm dbx
16643083Scaelwill read in the new information.
16743083Scael.Dp Cx Ic trace
16843083Scael.Cx \&\ \&
16943083Scael.Op Ic in Ar procedure/function
17043083Scael.Cx \&\ \&
17143083Scael.Op Ic if Ar condition
17243083Scael.Cx
17343083Scael.Dp Cx Ic trace
17443083Scael.Cx \&\ \&
17543083Scael.Ar source-line-number
17643083Scael.Cx \&\ \&
17743083Scael.Op Ic if Ar condition
17843083Scael.Cx
17943083Scael.Dp Cx Ic trace
18043083Scael.Cx \&\ \&
18143083Scael.Ar procedure/function
18243083Scael.Cx \&\ \&
18343083Scael.Op Ic in Ar procedure/function
18443083Scael.Cx \&\ \&
18543083Scael.Op Ic if Ar condition
18643083Scael.Cx
18743083Scael.Dp Cx Ic trace
18843083Scael.Cx \&\ \&
18943083Scael.Ar expression
19043083Scael.Cx \&\ \&
19143083Scael.Ic at
19243083Scael.Cx \&\ \&
19343083Scael.Ar source-line-number
19443083Scael.Cx \&\ \&
19543083Scael.Op Ic if Ar condition
19643083Scael.Cx
19743083Scael.Dp Cx Ic trace
19843083Scael.Cx \&\ \&
19943083Scael.Ar variable
20043083Scael.Cx \&\ \&
20143083Scael.Op Ic in Ar procedure/function
20243083Scael.Cx \&\ \&
20343083Scael.Op Ic if Ar condition
20443083Scael.Cx
20519716SmckusickHave tracing information printed when the program is executed.
20619716SmckusickA number is associated with the command that is used
20743083Scaelto turn the tracing off (see the
20843083Scael.Ic delete
20943083Scaelcommand).
21043083Scael.Pp
21119716SmckusickThe first argument describes what is to be traced.
21243083ScaelIf it is a
21343083Scael.Ar source-line-number ,
21443083Scaelthen the line is printed
21519716Smckusickimmediately prior to being executed.
21619716SmckusickSource line numbers in a file other than the current one
21719716Smckusickmust be preceded by the name of the file in quotes and a colon, e.g.
21819716Smckusick"mumble.p":17.
21943083Scael.Pp
22019716SmckusickIf the argument is a procedure or function name then
22119716Smckusickevery time it is called, information is printed telling
22219716Smckusickwhat routine called it, from what source line it was called,
22319716Smckusickand what parameters were passed to it.
22419716SmckusickIn addition, its return is noted, and if it's a function
22519716Smckusickthen the value it is returning is also printed.
22643083Scael.Pp
22743083ScaelIf the argument is an
22843083Scael.Ar expression
22943083Scaelwith an
23043083Scael.Ic at
23143083Scaelclause
23219716Smckusickthen the value of the expression is printed whenever the
23319716Smckusickidentified source line is reached.
23443083Scael.Pp
23519716SmckusickIf the argument is a variable then the name and value of the variable
23619716Smckusickis printed whenever it changes.
23719716SmckusickExecution is substantially slower during this form of tracing.
23843083Scael.Pp
23919716SmckusickIf no argument is specified then all source lines are printed
24019716Smckusickbefore they are executed.
24119716SmckusickExecution is substantially slower during this form of tracing.
24243083Scael.Pp
24343083ScaelThe clause
24443083Scael.Ic in
24543083Scael.Ar procedure/function
24643083Scaelrestricts tracing information
24719716Smckusickto be printed only while executing inside the given procedure
24819716Smckusickor function.
24943083Scael.Pp
25043083Scael.Ar Condition
25143083Scaelis a boolean expression and is
25219716Smckusickevaluated prior to printing the tracing information;
25319716Smckusickif it is false then the information is not printed.
25443083Scael.Dp Cx Ic stop if
25543083Scael.Cx \&\ \&
25643083Scael.Ar condition
25743083Scael.Cx
25843083Scael.Dp Cx Ic stop at
25943083Scael.Cx \&\ \&
26043083Scael.Ar source-line-number
26143083Scael.Cx \&\ \&
26243083Scael.Op Ic if Ar condition
26343083Scael.Cx
26443083Scael.Dp Cx Ic stop in
26543083Scael.Cx \&\ \&
26643083Scael.Ar source-line-number
26743083Scael.Cx \&\ \&
26843083Scael.Op Ic if Ar condition
26943083Scael.Cx
27043083Scael.Dp Cx Ic stop
27143083Scael.Cx \&\ \&
27243083Scael.Ar variable
27343083Scael.Cx \&\ \&
27443083Scael.Op Ic if Ar condition
27543083Scael.Cx
27619716SmckusickStop execution when the given line is reached, procedure or function
27719716Smckusickcalled, variable changed, or condition true.
27843083Scael.Dp Cx Ic status
27943083Scael.Cx \&\ \&
28043083Scael.Op Ic \&> Ar filename
28143083Scael.Cx
28243083ScaelPrint out the currently active
28343083Scael.Ic trace
28443083Scaeland
28543083Scael.Ic stop
28643083Scaelcommands.
28743083Scael.Dp Cx Ic delete
28843083Scael.Cx \&\ \&
28943083Scael.Ar command-number ...
29043083Scael.Cx
29119720SmckusickThe traces or stops corresponding to the given numbers are removed.
29219716SmckusickThe numbers associated with traces and stops are printed by
29343083Scaelthe
29443083Scael.Ic status
29543083Scaelcommand.
29643083Scael.Dp Cx Ic catch
29743083Scael.Cx \&\ \&
29843083Scael.Ar number
29943083Scael.Cx
30043083Scael.Dp Cx Ic catch
30143083Scael.Cx \&\ \&
30243083Scael.Ar signal-name
30343083Scael.Cx
30443083Scael.Dp Cx Ic ignore
30543083Scael.Cx \&\ \&
30643083Scael.Ar number
30743083Scael.Cx
30843083Scael.Dp Cx Ic ignore
30943083Scael.Cx \&\ \&
31043083Scael.Ar signal-name
31143083Scael.Cx
31219720SmckusickStart or stop trapping a signal before it is sent
31319716Smckusickto the program.
31419716SmckusickThis is useful when a program being debugged
31519716Smckusickhandles signals such as interrupts.
31619720SmckusickA signal may be specified by number or by a name
31719720Smckusick(e.g., SIGINT).
31819720SmckusickSignal names are case insensitive and the ``SIG'' prefix is optional.
31919720SmckusickBy default all signals are trapped except SIGCONT, SIGCHILD,
32019716SmckusickSIGALRM and SIGKILL.
32143083Scael.Dp Cx Ic cont
32243083Scael.Cx \&\ \&
32343083Scael.Ar integer
32443083Scael.Cx
32543083Scael.Dp Cx Ic cont
32643083Scael.Cx \&\ \&
32743083Scael.Ar signal-name
32843083Scael.Cx
32919716SmckusickContinue execution from where it stopped.
33019720SmckusickIf a signal is specified, the process continues as though
33119720Smckusickit received the signal.
33219720SmckusickOtherwise, the process is continued as though it had not been stopped.
33343083Scael.Pp
33419716SmckusickExecution cannot be continued if the process has ``finished'',
33519716Smckusickthat is, called the standard procedure ``exit''.
33643083Scael.Nm Dbx
33743083Scaeldoes not allow the process to exit, thereby
33819716Smckusickletting the user to examine the program state.
33943083Scael.Dp Ic step
34019716SmckusickExecute one source line.
34143083Scael.Dp Ic next
34219716SmckusickExecute up to the next source line.
34343083ScaelThe difference between this and
34443083Scael.Ic step
34543083Scaelis that
34619716Smckusickif the line contains a call to a procedure or function
34743083Scaelthe
34843083Scael.Ic step
34943083Scaelcommand will stop at the beginning of that
35043083Scaelblock, while the
35143083Scael.Ic next
35243083Scaelcommand will not.
35343083Scael.Dp Cx Ic return
35443083Scael.Cx \&\ \&
35543083Scael.Op Ar procedure
35643083Scael.Cx
35743083ScaelContinue until a return to
35843083Scael.Ar procedure
35943083Scaelis executed, or
36019720Smckusickuntil the current procedure returns if none is specified.
36143083Scael.Dp Cx Ic call
36243083Scael.Cx \&\ \&
36343083Scael.Ar procedure (parameters )
36443083Scael.Cx
36519720SmckusickExecute the object code associated with the named procedure or function.
36643083Scael.Dp
36743083Scael.Ss Printing Variables and Expressions
36819720SmckusickNames are resolved first using the static scope of the current function,
36919720Smckusickthen using the dynamic scope if the name is not defined
37019720Smckusickin the static scope.
37119720SmckusickIf static and dynamic searches do not yield a result,
37219720Smckusickan arbitrary symbol is chosen and
37343083Scaelthe message
374*44953Scael.Dq Li [using Ar qualified name]
37543083Scaelis printed.
37619720SmckusickThe name resolution procedure may be overridden by qualifying an identifier
37743083Scaelwith a block name, e.g.,
378*44953Scael.Dq Li module.variable
37919720SmckusickFor C, source files are treated as modules named
38019720Smckusickby the file name without ``.c''.
38143083Scael.Pp
38219720SmckusickExpressions are specified with an approximately
38319720Smckusickcommon subset of C and Pascal (or equivalently Modula-2) syntax.
38419720SmckusickIndirection can be denoted using either a prefix ``*'' or
38519720Smckusicka postfix ``^'' and
38643083Scaelarray expressions are subscripted by brackets
38743083Scael.Cx (``
38843083Scael.Op
38943083Scael.Cx \'\').
39043083Scael.Cx
39119716SmckusickThe field reference operator (``.'') can be used with pointers
39243083Scaelas well as records, making the C operator ``\->'' unnecessary
39319716Smckusick(although it is supported).
39443083Scael.Pp
39519720SmckusickTypes of expressions are checked;
39619720Smckusickthe type of an expression may be overridden
39743083Scaelby using
39843083Scael.Cx ``
39943083Scael.Ar type-name (expression)
40043083Scael.Cx \'\'.
40143083Scael.Cx
40219720SmckusickWhen there is no corresponding named type
40343083Scaelthe special constructs
40443083Scael.Cx ``&
40543083Scael.Ar type-name
40643083Scael.Cx \'\'
40743083Scael.Cx
40843083Scaeland
40943083Scael.Cx ``$$
41043083Scael.Ar tag-name
41143083Scael.Cx \'\'
41243083Scael.Cx
41319720Smckusickcan be used to represent a pointer to a named type or C structure tag.
41443083Scael.Dw Fl
41543083Scael.Di L
41643083Scael.Dp Cx Ic assign
41743083Scael.Cx \&\ \&
41843083Scael.Ar variable
41943083Scael.Ic =
42043083Scael.Ar expression
42143083Scael.Cx
42219720SmckusickAssign the value of the expression to the variable.
42343083Scael.Dp Cx Ic dump
42443083Scael.Cx \&\ \&
42543083Scael.Op Ar procedure
42643083Scael.Cx \&\ \&
42743083Scael.Op Ic > Ar filename
42843083Scael.Cx
42919720SmckusickPrint the names and values of variables in the given procedure,
43019720Smckusickor the current one if none is specified.
43119720SmckusickIf the procedure given is ``.'', then the all active variables
43219720Smckusickare dumped.
43343083Scael.Dp Cx Ic print
43443083Scael.Cx \&\ \&
43543083Scael.Ar expression
43643083Scael.Cx \&\ \&
43743083Scael.Op Ic \&, Ar expression ...
43843083Scael.Cx
43919720SmckusickPrint out the values of the expressions.
44043083Scael.Dp Cx Ic whatis
44143083Scael.Cx \&\ \&
44243083Scael.Ar name
44343083Scael.Cx
44419716SmckusickPrint the declaration of the given name, which may be qualified
44519716Smckusickwith block names as above.
44643083Scael.Dp Cx Ic which
44743083Scael.Cx \&\ \&
44843083Scael.Ar identifier
44943083Scael.Cx
45019716SmckusickPrint the full qualification of the given identifer, i.e.
45119716Smckusickthe outer blocks that the identifier is associated with.
45243083Scael.Dp Cx Ic up
45343083Scael.Cx \&\ \&
45443083Scael.Op Ar count
45543083Scael.Cx
45643083Scael.Dp Cx Ic down
45743083Scael.Cx \&\ \&
45843083Scael.Op Ar count
45943083Scael.Cx
46019720SmckusickMove the current function, which is used for resolving names,
46143083Scaelup or down the stack
46243083Scael.Ar count
46343083Scaellevels.
46443083ScaelThe default
46543083Scael.Ar count
46643083Scaelis 1.
46743083Scael.Dp Ic where
46819720SmckusickPrint out a list of the active procedures and function.
46943083Scael.Dp Cx Ic whereis
47043083Scael.Cx \&\ \&
47143083Scael.Ar identifier
47243083Scael.Cx
47319716SmckusickPrint the full qualification of all the symbols whose
47419716Smckusickname matches the given identifier.
47519716SmckusickThe order in which the symbols are printed is not meaningful.
476*44953Scael.Dp
47743083Scael.Ss Accessing Source Files
47843083Scael.Pp
479*44953Scael.Di L
48043083Scael.Dp Cx Ar /regular expression
48143083Scael.Op /
48243083Scael.Cx
48343083Scael.Dp Cx Ar ?regular expression
48443083Scael.Op ?
48543083Scael.Cx
48619720SmckusickSearch forward or backward in the current source file
48719720Smckusickfor the given pattern.
48843083Scael.Dp Cx Ic edit
48943083Scael.Cx \&\ \&
49043083Scael.Op Ar filename
49143083Scael.Cx
49243083Scael.Dp Cx Ic edit
49343083Scael.Cx \&\ \&
49443083Scael.Ar procedure/function-name
49543083Scael.Cx
49643083ScaelInvoke an editor on
49743083Scael.Ar filename
49843083Scaelor the current source file if none
49919716Smckusickis specified.
50043083ScaelIf a
50143083Scael.Ar procedure
50243083Scaelor
50343083Scael.Ar function
50443083Scaelname is specified,
50519716Smckusickthe editor is invoked on the file that contains it.
50619716SmckusickWhich editor is invoked by default depends on the installation.
50719716SmckusickThe default can be overridden by setting the environment variable
50843083Scael.Ev EDITOR
50943083Scaelto the name of the desired editor.
51043083Scael.Dp Cx Ic file
51143083Scael.Cx \&\ \&
51243083Scael.Op Ar filename
51343083Scael.Cx
51443083ScaelChange the current source file name to
51543083Scael.Ar filename  .
51619716SmckusickIf none is specified then the current source file name is printed.
51743083Scael.Dp Cx Ic func
51843083Scael.Cx \&\ \&
51943083Scael.Op Ar procedure/function
52043083Scael.Cx
52119716SmckusickChange the current function.
52219716SmckusickIf none is specified then print the current function.
52319716SmckusickChanging the current function implicitly changes the current source file
52419716Smckusickto the one that contains the function; it also changes the current scope
52519716Smckusickused for name resolution.
52643083Scael.Dp Cx Ic list
52743083Scael.Cx \&\ \&
52843083Scael.Op Ar source-line-number Op Ic \&, Ar source-line-number
52943083Scael.Cx
53043083Scael.Dp Cx Ic list
53143083Scael.Cx \&\ \&
53243083Scael.Ar procedure/function
53343083Scael.Cx
53419716SmckusickList the lines in the current source file from the first line number to
53519716Smckusickthe second inclusive.
53619716SmckusickIf no lines are specified, the next 10 lines are listed.
53719716SmckusickIf the name of a procedure or function is given
53843083Scaellines
53943083Scael.Ar n-k
54043083Scaelto
541*44953Scael.Ar n+k
54243083Scaelare listed where
54343083Scael.Ar n
54443083Scaelis the first statement
54543083Scaelin the procedure or function and
54643083Scael.Ar k
54743083Scaelis small.
54843083Scael.Dp Cx Ic use
54943083Scael.Cx \&\ \&
55043083Scael.Ar directory-list
55143083Scael.Cx
55219716SmckusickSet the list of directories to be searched
55319716Smckusickwhen looking for source files.
55443083Scael.Dp
55543083Scael.Ss Command Aliases and Variables
55643083Scael.Dw Fl
55743083Scael.Di L
55843083Scael.Dp Cx Ic alias
55943083Scael.Cx \&\ \&
56043083Scael.Ar name
56143083Scael.Cx \&\ \&
56243083Scael.Ar name
56343083Scael.Cx
56443083Scael.Dp Cx Ic alias
56543083Scael.Cx \&\ \&
56643083Scael.Ar name
56743083Scael.Cx \&\ \&
56843083Scael.Ar string
56943083Scael.Cx
57043083Scael.Dp Cx Ic alias
57143083Scael.Cx \&\ \&
57243083Scael.Ar name (parameters)
57343083Scael.Cx \&\ \&
57443083Scael.Cx ``
57543083Scael.Ar string
57643083Scael.Cx \'\'
57743083Scael.Cx
57819720SmckusickWhen commands are processed,
57943083Scaeldbx first checks to see if the word
58019720Smckusickis an alias for either a command or a string.
58143083ScaelIf it is an alias, then dbx treats the input as though
58219720Smckusickthe corresponding string (with values substituted for any parameters)
58319720Smckusickhad been entered.
58419720SmckusickFor example,
58519720Smckusickto define an alias ``rr'' for the command ``rerun'',
58619720Smckusickone can say
58743083Scael.Pp
58843083Scael.Dl alias rr rerun
58943083Scael.Pp
59019720SmckusickTo define an alias called ``b'' that sets a stop at a particular line
59119720Smckusickone can say
59243083Scael.Pp
59343083Scael.Dl alias b(x) ``stop at x''
59443083Scael.Pp
59519720SmckusickSubsequently, the command ``b(12)'' will expand to ``stop at 12''.
59643083Scael.Pp
59743083Scael.Dp Cx Ic set
598*44953Scael.Ws
59943083Scael.Ar name
60043083Scael.Op \&= Ar expression
60143083Scael.Cx
60243083ScaelThe
60343083Scael.Ic set
60443083Scaelcommand defines values for debugger variables.
60519720SmckusickThe names of these variables cannot conflict with names in the program
60619720Smckusickbeing debugged, and are expanded to the corresponding expression
60719720Smckusickwithin other commands.
60819720SmckusickThe following variables have a special meaning:
60943083Scael.Dw Ds
61043083Scael.Di L
61143083Scael.Dp Li $frame
61243083ScaelSetting this variable to an address causes dbx to use the stack frame
61319720Smckusickpointed to by the address for
61419720Smckusickdoing stack traces and accessing local variables.
61519720SmckusickThis facility is of particular use for kernel debugging.
61643083Scael.Dp Li $hexchars
61743083Scael.Dp Li $hexints
61843083Scael.Dp Li $hexoffsets
61943083Scael.Dp Li $hexstrings
62043083ScaelWhen set, dbx prints out
62119720Smckusickout characters, integers, offsets from registers, or character pointers
62219720Smckusickrespectively in hexadecimal.
62343083Scael.Dp Li $listwindow
62419720SmckusickThe value of this variable specifies the number
62543083Scaelof lines to list around a function or when the
62643083Scael.Ic list
62743083Scaelcommand
62819720Smckusickis given without any parameters.
62919720SmckusickIts default value is 10.
63043083Scael.Dp Li $mapaddrs
63143083ScaelSetting (unsetting) this variable causes dbx to start (stop)
63219720Smckusickmapping addresses.
63319720SmckusickAs with ``$frame'', this is useful for kernel debugging.
63443083Scael.Dp Li $unsafecall
63543083Scael.Dp Li $unsafeassign
63625878SdonnWhen ``$unsafecall'' is set,
63725878Sdonnstrict type checking is turned off for arguments to
63843083Scaelsubroutine or function calls (
63943083Scael.Ar e .g .
64043083Scaelin the
64143083Scael.Ic call
64243083Scaelstatement).
64325878SdonnWhen ``$unsafeassign'' is set,
64425878Sdonnstrict type checking between the two sides
64543083Scaelof an
64643083Scael.Ic assign
64743083Scaelstatement is turned off.
64825878SdonnThese variables should be used only with great care,
64943083Scaelbecause they severely limit dbx's usefulness
65025878Sdonnfor detecting errors.
65143083Scael.Dp
65243083Scael.Dp Cx Ic unalias
65343083Scael.Cx \&\ \&
65443083Scael.Ar name
65543083Scael.Cx
65619720SmckusickRemove the alias with the given name.
65743083Scael.Dp Cx Ic unset
65843083Scael.Cx \&\ \&
65943083Scael.Ar name
66043083Scael.Cx
66143083ScaelDelete the debugger variable associated with
66243083Scael.Ar name  .
66343083Scael.Dp
66443083Scael.Ss Machine Level Commands
66543083Scael.Dw Fl
66643083Scael.Di L
66743083Scael.Dp Cx Ic tracei
66843083Scael.Cx \&\ \&
66943083Scael.Op Ar address
67043083Scael.Cx \&\ \&
67143083Scael.Op .Ic if Ar cond
67243083Scael.Cx
67343083Scael.Dp Cx Ic tracei
67443083Scael.Cx \&\ \&
67543083Scael.Op Ar variable
67643083Scael.Cx \&\ \&
67743083Scael.Op Ic at Ar address
67843083Scael.Cx \&\ \&
67943083Scael.Op Ic if Ar cond
68043083Scael.Cx
68143083Scael.Dp Cx Ic stopi
68243083Scael.Cx \&\ \&
68343083Scael.Op Ar address
68443083Scael.Cx \&\ \&
68543083Scael.Op Ic if Ar cond
68643083Scael.Cx
68743083Scael.Dp Cx Ic stopi
68843083Scael.Cx \&\ \&
68943083Scael.Op Ic at
69043083Scael.Cx \&\ \&
69143083Scael.Op Ar address
69243083Scael.Cx \&\ \&
69343083Scael.Op Ic if Ar cond
69443083Scael.Cx
69519716SmckusickTurn on tracing or set a stop using a machine instruction address.
69643083Scael.Dp Ic stepi
69743083Scael.Dp Ic nexti
69843083ScaelSingle step as in
69943083Scael.Ic step
70043083Scaelor
70143083Scael.Ic next  ,
70243083Scaelbut do a single instruction
70319716Smckusickrather than source line.
70443083Scael.Dp Cx Ar address
70543083Scael.Cx \&,
70643083Scael.Ar address
70743083Scael.Cx \&/
70843083Scael.Op Ar mode
70943083Scael.Cx
71043083Scael.Dp Cx Ar address
71143083Scael.Cx \&/
71243083Scael.Op Ar count
71343083Scael.Op Ar mode
71443083Scael.Cx
71543083ScaelPrint the contents of memory starting at the first
71643083Scael.Ar address
71743083Scaeland continuing up to the second
71843083Scael.Ar address
71943083Scaelor until
72043083Scael.Ar count
72143083Scaelitems are printed.
72219720SmckusickIf the address is ``.'', the address following the one
72319716Smckusickprinted most recently is used.
72443083ScaelThe
72543083Scael.Ar mode
72643083Scaelspecifies how memory is to be printed;
72719716Smckusickif it is omitted the previous mode specified is used.
72819716SmckusickThe initial mode is ``X''.
72919716SmckusickThe following modes are supported:
73043083Scael.Dw Cm
73143083Scael.Dp Cm i
73219716Smckusickprint the machine instruction
73343083Scael.Dp Cm d
73419716Smckusickprint a short word in decimal
73543083Scael.Dp Cm D
73619716Smckusickprint a long word in decimal
73743083Scael.Dp Cm o
73819716Smckusickprint a short word in octal
73943083Scael.Dp Cm O
74019716Smckusickprint a long word in octal
74143083Scael.Dp Cm x
74219716Smckusickprint a short word in hexadecimal
74343083Scael.Dp Cm X
74419716Smckusickprint a long word in hexadecimal
74543083Scael.Dp Cm b
74619716Smckusickprint a byte in octal
74743083Scael.Dp Cm c
74819716Smckusickprint a byte as a character
74943083Scael.Dp Cm s
75019716Smckusickprint a string of characters terminated by a null byte
75143083Scael.Dp Cm f
75219716Smckusickprint a single precision real number
75343083Scael.Dp Cm g
75419716Smckusickprint a double precision real number
75543083Scael.Dp
75643083Scael.Pp
75719716SmckusickSymbolic addresses are specified by preceding the name with an ``&''.
75819716SmckusickRegisters are denoted by ``$rN'' where N is the number of the register.
75919716SmckusickAddresses may be expressions made up of other addresses and
76019716Smckusickthe operators ``+'', ``-'', and indirection (unary ``*'').
76143083Scael.Dp
76243083Scael.Ss Miscellaneous Commands
76343083Scael.Tw Ic
76443083Scael.Tp Ic gripe
76543083ScaelInvoke a mail program to send a message to the person in charge of
76643083Scael.Nm dbx  .
76743083Scael.Tp Ic help
76843083ScaelPrint out a synopsis of
76943083Scael.Nm dbx
77043083Scaelcommands.
77143083Scael.Tp Ic quit
77243083ScaelExit
77343083Scael.Nm dbx  .
77443083Scael.Tp Cx Ic sh
77543083Scael.Cx \&\ \&
77643083Scael.Ar command-line
77743083Scael.Cx
77819716SmckusickPass the command line to the shell for execution.
77919716SmckusickThe SHELL environment variable determines which shell is used.
78043083Scael.Tp Cx Ic source
78143083Scael.Cx \&\ \&
78243083Scael.Ar filename
78343083Scael.Cx
78443083ScaelRead
78543083Scael.Nm dbx
78643083Scaelcommands from the given
78743083Scael.Ar filename  .
78843083Scael.Tp
78943083Scael.Sh ENVIRONMENT
79043083Scael.Nm Dbx
791*44953Scaelutilizes the following environment variables:
79243083Scael.Ds I
79343083ScaelEDITOR
79443083ScaelHOME
79543083ScaelPATH
79643083ScaelSHELL
79743083Scael.De
79843083Scael.Sh FILES
79943083Scael.Dw .dbxinit
80043083Scael.Di L
80143083Scael.Dp Pa a.out
80219716Smckusickobject file
80343083Scael.Dp Pa .dbxinit
80419716Smckusickinitial commands
80543083Scael.Dp
80643083Scael.Sh SEE ALSO
80743083Scael.Xr cc 1 ,
80843083Scael.Xr mod l ,
80943083Scael.Xr f77 1 ,
81043083Scael.Xr pc 1
81143083Scael.Sh HISTORY
81243083Scael.Nm Dbx
81343083Scaelappeared in 4.2 BSD.
81443083Scael.Sh BUGS
81543083Scael.Nm Dbx
81643083Scaelsuffers from the same ``multiple include'' malady as did
81743083Scael.Nm sdb  .
81819716SmckusickIf you have a program consisting of a number of object files
81919716Smckusickand each is built from source files that include header files,
82019716Smckusickthe symbolic information for the header files is replicated in
82119716Smckusickeach object file.
82219716SmckusickSince about one debugger start-up is done for each link,
82343083Scaelhaving the linker
82443083Scael.Xr ld 1
82543083Scaelre-organize the symbol information
82619720Smckusickwould not save much time, though it would reduce some of the
82719716Smckusickdisk space used.
82843083Scael.Pp
82919720SmckusickThis problem is an artifact of the unrestricted semantics
83019716Smckusickof #include's in C; for example an include file can contain
83119716Smckusickstatic declarations that are separate entities for each file
83219716Smckusickin which they are included.
83319720SmckusickHowever, even with Modula-2 there is a substantial amount of duplication
83419720Smckusickof symbol information necessary for inter-module type checking.
83543083Scael.Pp
83625878SdonnSome problems remain with the support for individual languages.
83725878SdonnFortran problems include:
83825878Sdonninability to assign to logical, logical*2, complex
83925878Sdonnand double complex variables;
84025878Sdonninability to represent parameter constants
84125878Sdonnwhich are not type integer or real;
84225878Sdonnpeculiar representation for the values of dummy procedures
84325878Sdonn(the value shown for a dummy procedure is actually
84425878Sdonnthe first few bytes of the procedure text;
84525878Sdonnto find the location of the procedure,
84625878Sdonnuse ``&'' to take the address of the variable).
847