xref: /csrg-svn/old/dbx/dbx.1 (revision 50838)
143083Scael.\" Copyright (c) 1983, 1990 The Regents of the University of California.
238105Sbostic.\" All rights reserved.
319716Smckusick.\"
4*50838Scael.\" %sccs.include.redist.roff%
519716Smckusick.\"
6*50838Scael.\"     @(#)dbx.1	6.6 (Berkeley) 08/09/91
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
2344953Scael.Nm Dbx
2443083Scaelis a tool for source level debugging and execution of
25*50838Scaelprograms under
26*50838Scael.Ux .
2743083ScaelThe
2843083Scael.Ar objfile
2943083Scaelis an object file produced by a compiler
3043083Scaelwith the appropriate flag (usually
3143083Scael.Fl g )
3219716Smckusickspecified to produce symbol information in the object file.
3343083ScaelCurrently,
3443083Scael.Xr cc 1 ,
3543083Scael.Xr f77 1 ,
3643083Scael.Xr pc 1 ,
37*50838Scaeland the
38*50838Scael.Tn DEC
39*50838ScaelWestern
4043083ScaelResearch Laboratory Modula-2 compiler,
4143083Scael.Xr mod l ,
4219720Smckusickproduce the appropriate source information.
4343083ScaelThe machine level facilities of
4443083Scael.Nm dbx
4519716Smckusickcan be used on any program.
4643083Scael.Pp
4744953ScaelThe object file contains a symbol table that includes the names of
4819716Smckusickall the source files translated by the compiler to create it.
4919716SmckusickThese files are available for perusal while using the debugger.
5043083Scael.Pp
5144953ScaelIf a file named
5244953Scael.Pa core
5343083Scaelexists in the current directory
5443083Scaelor a
5543083Scael.Ar coredump
5643083Scaelfile is specified,
5743083Scael.Nm dbx
5843083Scaelcan be used
5919716Smckusickto examine the state of the program when it faulted.
6043083Scael.Pp
6144953ScaelIf the file
6244953Scael.Pa .dbxinit
6344953Scaelexists in the current directory then the
6419716Smckusickdebugger commands in it are executed.
6543083Scael.Nm Dbx
6644953Scaelalso checks for a
6744953Scael.Pa .dbxinit
6844953Scaelin the user's home directory
6919716Smckusickif there isn't one in the current directory.
7043083Scael.Pp
7119716SmckusickThe command line options and their meanings are:
72*50838Scael.Bl -tag -width indent
73*50838Scael.It Fl r
7443083ScaelExecute
7543083Scael.Ar objfile
7643083Scaelimmediately.
7743083ScaelIf it terminates successfully
7843083Scael.Nm dbx
7943083Scaelexits.
8019716SmckusickOtherwise the reason for termination will be reported
8119716Smckusickand the user offered the option of entering the debugger
8219716Smckusickor letting the program fault.
8343083Scael.Nm Dbx
8444953Scaelwill read from
8544953Scael.Pa /dev/tty
8644953Scaelwhen
8743083Scael.Fl r
8843083Scaelis specified
8919716Smckusickand standard input is not a terminal.
90*50838Scael.It Fl i
9143083ScaelForce
9243083Scael.Nm dbx
9343083Scaelto act as though standard input is a terminal.
94*50838Scael.It Fl k
9519720SmckusickMap memory addresses, useful for kernel debugging.
96*50838Scael.It Fl I Ar dir
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
10844953Scael.Ic use
10943083Scaelcommand.
110*50838Scael.It Fl c Ar file
11143083ScaelExecute the
11243083Scael.Nm dbx
11343083Scaelcommands in the
11443083Scael.Ar file
11543083Scaelbefore
11619720Smckusickreading from standard input.
117*50838Scael.El
11843083Scael.Pp
11943083ScaelUnless
12043083Scael.Fl r
12143083Scaelis specified,
12243083Scael.Nm dbx
12343083Scaeljust prompts and waits for a command.
12443083Scael.Ss Execution and Tracing Commands
125*50838Scael.Pp
126*50838Scael.Bl -tag -width indent -compact
127*50838Scael.It Xo
128*50838Scael.Ic run Op Ar args
12943083Scael.Op Sy < Ar filename
130*50838Scael.Op Sy > Ar filename
131*50838Scael.Xc
132*50838Scael.It Xo
133*50838Scael.Ic rerun
13443083Scael.Op Ar args
13543083Scael.Op Sy < Ar filename
136*50838Scael.Op Sy > Ar filename
137*50838Scael.Xc
13843083ScaelStart executing
13943083Scael.Ar objfile  ,
14043083Scaelpassing
14143083Scael.Ar args
14243083Scaelas command line arguments;
14343083Scael.Sy <
14443083Scaelor
14543083Scael.Sy >
14643083Scaelcan be used to redirect input or output in the usual manner.
14743083ScaelWhen
14843083Scael.Ic rerun
14943083Scaelis used without any arguments the previous
15019720Smckusickargument list is passed to the program;
15143083Scaelotherwise it is identical to
15243083Scael.Ic run .
15343083ScaelIf
15443083Scael.Ar objfile
15543083Scaelhas been written since the last time the symbolic information
15643083Scaelwas read in,
15743083Scael.Nm dbx
15843083Scaelwill read in the new information.
159*50838Scael.Pp
160*50838Scael.It Xo
161*50838Scael.Ic trace
162*50838Scael.Op Ic \&in Ar procedure/function
163*50838Scael.Op Ic \&if Ar condition
164*50838Scael.Xc
165*50838Scael.It Xo
166*50838Scael.Ic trace Ar source-line-number
167*50838Scael.Op Ic \&if Ar condition
168*50838Scael.Xc
169*50838Scael.It Xo
170*50838Scael.Ic trace Ar procedure/function
171*50838Scael.Op Ic \&in Ar procedure/function
172*50838Scael.Op Ic \&if Ar condition
173*50838Scael.Xc
174*50838Scael.It Xo
175*50838Scael.Ic trace Ar expression
176*50838Scael.Ic \&at Ar source-line-number
177*50838Scael.Op Ic \&if Ar condition
178*50838Scael.Xc
179*50838Scael.It Xo
180*50838Scael.Ic trace Ar variable
181*50838Scael.Op Ic \&in Ar procedure/function
182*50838Scael.Op Ic \&if Ar condition
183*50838Scael.Xc
18419716SmckusickHave tracing information printed when the program is executed.
18519716SmckusickA number is associated with the command that is used
18643083Scaelto turn the tracing off (see the
18743083Scael.Ic delete
18843083Scaelcommand).
18943083Scael.Pp
19019716SmckusickThe first argument describes what is to be traced.
19143083ScaelIf it is a
19243083Scael.Ar source-line-number ,
19343083Scaelthen the line is printed
19419716Smckusickimmediately prior to being executed.
19519716SmckusickSource line numbers in a file other than the current one
19619716Smckusickmust be preceded by the name of the file in quotes and a colon, e.g.
19719716Smckusick"mumble.p":17.
19843083Scael.Pp
19919716SmckusickIf the argument is a procedure or function name then
20019716Smckusickevery time it is called, information is printed telling
20119716Smckusickwhat routine called it, from what source line it was called,
20219716Smckusickand what parameters were passed to it.
20319716SmckusickIn addition, its return is noted, and if it's a function
20419716Smckusickthen the value it is returning is also printed.
20543083Scael.Pp
20643083ScaelIf the argument is an
20743083Scael.Ar expression
20843083Scaelwith an
20943083Scael.Ic at
21043083Scaelclause
21119716Smckusickthen the value of the expression is printed whenever the
21219716Smckusickidentified source line is reached.
21343083Scael.Pp
21419716SmckusickIf the argument is a variable then the name and value of the variable
21519716Smckusickis printed whenever it changes.
21619716SmckusickExecution is substantially slower during this form of tracing.
21743083Scael.Pp
21819716SmckusickIf no argument is specified then all source lines are printed
21919716Smckusickbefore they are executed.
22019716SmckusickExecution is substantially slower during this form of tracing.
22143083Scael.Pp
22243083ScaelThe clause
22343083Scael.Ic in
22443083Scael.Ar procedure/function
22543083Scaelrestricts tracing information
22619716Smckusickto be printed only while executing inside the given procedure
22719716Smckusickor function.
22843083Scael.Pp
22943083Scael.Ar Condition
23043083Scaelis a boolean expression and is
23119716Smckusickevaluated prior to printing the tracing information;
23219716Smckusickif it is false then the information is not printed.
233*50838Scael.Pp
234*50838Scael.It Ic "stop if" Ar condition
235*50838Scael.It Xo
236*50838Scael.Ic "stop at" Ar source-line-number
237*50838Scael.Op Ic \&if Ar condition
238*50838Scael.Xc
239*50838Scael.It Xo
240*50838Scael.Ic "stop in" Ar source-line-number
241*50838Scael.Op Ic \&if Ar condition
242*50838Scael.Xc
243*50838Scael.It Xo
244*50838Scael.Ic stop Ar variable
245*50838Scael.Op Ic \&if Ar condition
246*50838Scael.Xc
24719716SmckusickStop execution when the given line is reached, procedure or function
24819716Smckusickcalled, variable changed, or condition true.
249*50838Scael.Pp
250*50838Scael.It Ic status Op Ic \&> Ar filename
25143083ScaelPrint out the currently active
25243083Scael.Ic trace
25343083Scaeland
25443083Scael.Ic stop
25543083Scaelcommands.
256*50838Scael.Pp
257*50838Scael.It Ic delete Ar command-number ...
25819720SmckusickThe traces or stops corresponding to the given numbers are removed.
25919716SmckusickThe numbers associated with traces and stops are printed by
26043083Scaelthe
26143083Scael.Ic status
26243083Scaelcommand.
263*50838Scael.Pp
264*50838Scael.It Ic catch Ar number
265*50838Scael.It Ic catch Ar signal-name
266*50838Scael.It Ic ignore Ar number
267*50838Scael.It Ic ignore Ar signal-name
26819720SmckusickStart or stop trapping a signal before it is sent
26919716Smckusickto the program.
27019716SmckusickThis is useful when a program being debugged
27119716Smckusickhandles signals such as interrupts.
27219720SmckusickA signal may be specified by number or by a name
273*50838Scael(e.g.,
274*50838Scael.Dv SIGINT ) .
275*50838ScaelSignal names are case insensitive and the
276*50838Scael.Dq Dv SIG
277*50838Scaelprefix is optional.
278*50838ScaelBy default all signals are trapped except
279*50838Scael.Dv SIGCONT ,
280*50838Scael.Dv SIGCHILD ,
281*50838Scael.Dv SIGALRM
282*50838Scaeland
283*50838Scael.Dv SIGKILL .
284*50838Scael.Pp
285*50838Scael.It Ic cont Ar integer
286*50838Scael.It Ic cont Ar signal-name
28719716SmckusickContinue execution from where it stopped.
28819720SmckusickIf a signal is specified, the process continues as though
28919720Smckusickit received the signal.
29019720SmckusickOtherwise, the process is continued as though it had not been stopped.
29143083Scael.Pp
29219716SmckusickExecution cannot be continued if the process has ``finished'',
29319716Smckusickthat is, called the standard procedure ``exit''.
29443083Scael.Nm Dbx
29543083Scaeldoes not allow the process to exit, thereby
29619716Smckusickletting the user to examine the program state.
297*50838Scael.Pp
298*50838Scael.It Ic step
29919716SmckusickExecute one source line.
300*50838Scael.Pp
301*50838Scael.It Ic next
30219716SmckusickExecute up to the next source line.
30343083ScaelThe difference between this and
30443083Scael.Ic step
30543083Scaelis that
30619716Smckusickif the line contains a call to a procedure or function
30743083Scaelthe
30843083Scael.Ic step
30943083Scaelcommand will stop at the beginning of that
31043083Scaelblock, while the
31143083Scael.Ic next
31243083Scaelcommand will not.
313*50838Scael.Pp
314*50838Scael.It Ic return Op Ar procedure
31543083ScaelContinue until a return to
31643083Scael.Ar procedure
31743083Scaelis executed, or
31819720Smckusickuntil the current procedure returns if none is specified.
319*50838Scael.Pp
320*50838Scael.It Ic call Ar procedure(parameters )
32119720SmckusickExecute the object code associated with the named procedure or function.
322*50838Scael.El
32343083Scael.Ss Printing Variables and Expressions
32419720SmckusickNames are resolved first using the static scope of the current function,
32519720Smckusickthen using the dynamic scope if the name is not defined
32619720Smckusickin the static scope.
32719720SmckusickIf static and dynamic searches do not yield a result,
32819720Smckusickan arbitrary symbol is chosen and
32943083Scaelthe message
330*50838Scael.Dq Bq Li using Ar qualified name
33143083Scaelis printed.
33219720SmckusickThe name resolution procedure may be overridden by qualifying an identifier
33343083Scaelwith a block name, e.g.,
33444953Scael.Dq Li module.variable
33519720SmckusickFor C, source files are treated as modules named
33619720Smckusickby the file name without ``.c''.
33743083Scael.Pp
33819720SmckusickExpressions are specified with an approximately
33919720Smckusickcommon subset of C and Pascal (or equivalently Modula-2) syntax.
34019720SmckusickIndirection can be denoted using either a prefix ``*'' or
34119720Smckusicka postfix ``^'' and
34243083Scaelarray expressions are subscripted by brackets
343*50838Scael.Pq Dq Bq
34419716SmckusickThe field reference operator (``.'') can be used with pointers
34543083Scaelas well as records, making the C operator ``\->'' unnecessary
34619716Smckusick(although it is supported).
34743083Scael.Pp
34819720SmckusickTypes of expressions are checked;
34919720Smckusickthe type of an expression may be overridden
35043083Scaelby using
351*50838Scael.Dq Ar type-name Ns Pq Ar expression .
35219720SmckusickWhen there is no corresponding named type
35343083Scaelthe special constructs
354*50838Scael.Dq Ar &type-name
35543083Scaeland
356*50838Scael.Dq Ar $$tag-name
35719720Smckusickcan be used to represent a pointer to a named type or C structure tag.
358*50838Scael.Pp
359*50838Scael.Bl -tag -width indent -compact
360*50838Scael.It Ic assign Ar variable Ic = Ar expression
36119720SmckusickAssign the value of the expression to the variable.
362*50838Scael.Pp
363*50838Scael.It Xo
364*50838Scael.Ic dump
36543083Scael.Op Ar procedure
366*50838Scael.Op Ic > Ar filename
367*50838Scael.Xc
36819720SmckusickPrint the names and values of variables in the given procedure,
36919720Smckusickor the current one if none is specified.
37019720SmckusickIf the procedure given is ``.'', then the all active variables
37119720Smckusickare dumped.
372*50838Scael.Pp
373*50838Scael.It Xo
374*50838Scael.Ic print Ar expression
375*50838Scael.Op Ic \&, Ar expression ...
376*50838Scael.Xc
37719720SmckusickPrint out the values of the expressions.
378*50838Scael.Pp
379*50838Scael.It Ic whatis Ar name
38019716SmckusickPrint the declaration of the given name, which may be qualified
38119716Smckusickwith block names as above.
382*50838Scael.Pp
383*50838Scael.It Ic which Ar identifier
38419716SmckusickPrint the full qualification of the given identifer, i.e.
38519716Smckusickthe outer blocks that the identifier is associated with.
386*50838Scael.Pp
387*50838Scael.It Ic up Op Ar count
388*50838Scael.It Ic down Op Ar count
38919720SmckusickMove the current function, which is used for resolving names,
39043083Scaelup or down the stack
39143083Scael.Ar count
39243083Scaellevels.
39343083ScaelThe default
39443083Scael.Ar count
39543083Scaelis 1.
396*50838Scael.Pp
397*50838Scael.It Ic where
39819720SmckusickPrint out a list of the active procedures and function.
399*50838Scael.Pp
400*50838Scael.It Ic whereis Ar identifier
40119716SmckusickPrint the full qualification of all the symbols whose
40219716Smckusickname matches the given identifier.
40319716SmckusickThe order in which the symbols are printed is not meaningful.
404*50838Scael.El
40543083Scael.Ss Accessing Source Files
40643083Scael.Pp
407*50838Scael.Bl -tag -width indent -compact
408*50838Scael.It Ns / Ar "regular expression" Ns Op /
409*50838Scael.It Ns ? Ar "regular expression" Ns Op ?
41019720SmckusickSearch forward or backward in the current source file
41119720Smckusickfor the given pattern.
412*50838Scael.Pp
413*50838Scael.It Ic edit Op Ar filename
414*50838Scael.It Ic edit Ar procedure/function-name
41543083ScaelInvoke an editor on
41643083Scael.Ar filename
41743083Scaelor the current source file if none
41819716Smckusickis specified.
41943083ScaelIf a
42043083Scael.Ar procedure
42143083Scaelor
42243083Scael.Ar function
42343083Scaelname is specified,
42419716Smckusickthe editor is invoked on the file that contains it.
42519716SmckusickWhich editor is invoked by default depends on the installation.
42619716SmckusickThe default can be overridden by setting the environment variable
42743083Scael.Ev EDITOR
42843083Scaelto the name of the desired editor.
429*50838Scael.Pp
430*50838Scael.It Ic file Op Ar filename
43143083ScaelChange the current source file name to
43243083Scael.Ar filename  .
43319716SmckusickIf none is specified then the current source file name is printed.
434*50838Scael.Pp
435*50838Scael.It Ic func Op Ar procedure/function
43619716SmckusickChange the current function.
43719716SmckusickIf none is specified then print the current function.
43819716SmckusickChanging the current function implicitly changes the current source file
43919716Smckusickto the one that contains the function; it also changes the current scope
44019716Smckusickused for name resolution.
441*50838Scael.Pp
442*50838Scael.It Xo
443*50838Scael.Ic list
444*50838Scael.Oo Ar source-line-number
445*50838Scael.Op Ic \&, Ar source-line-number Oc
446*50838Scael.Xc
447*50838Scael.It Ic list Ar procedure/function
44819716SmckusickList the lines in the current source file from the first line number to
44919716Smckusickthe second inclusive.
45019716SmckusickIf no lines are specified, the next 10 lines are listed.
45119716SmckusickIf the name of a procedure or function is given
45243083Scaellines
45343083Scael.Ar n-k
45443083Scaelto
45544953Scael.Ar n+k
45643083Scaelare listed where
45743083Scael.Ar n
45843083Scaelis the first statement
45943083Scaelin the procedure or function and
46043083Scael.Ar k
46143083Scaelis small.
462*50838Scael.Pp
463*50838Scael.It Ic use Ar directory-list
46419716SmckusickSet the list of directories to be searched
46519716Smckusickwhen looking for source files.
466*50838Scael.El
46743083Scael.Ss Command Aliases and Variables
468*50838Scael.Pp
469*50838Scael.Bl -tag -width indent -compact
470*50838Scael.It Ic alias Ar name Ar name
471*50838Scael.It Ic alias Ar name Ar string
472*50838Scael.It Xo
473*50838Scael.Ic alias
474*50838Scael.Ar name Pq Ar parameters
475*50838Scael.Dq Ar string
476*50838Scael.Xc
47719720SmckusickWhen commands are processed,
47843083Scaeldbx first checks to see if the word
47919720Smckusickis an alias for either a command or a string.
48043083ScaelIf it is an alias, then dbx treats the input as though
48119720Smckusickthe corresponding string (with values substituted for any parameters)
48219720Smckusickhad been entered.
48319720SmckusickFor example,
48419720Smckusickto define an alias ``rr'' for the command ``rerun'',
48519720Smckusickone can say
48643083Scael.Pp
487*50838Scael.Dl alias \&rr rerun
48843083Scael.Pp
48919720SmckusickTo define an alias called ``b'' that sets a stop at a particular line
49019720Smckusickone can say
49143083Scael.Pp
49243083Scael.Dl alias b(x) ``stop at x''
49343083Scael.Pp
49419720SmckusickSubsequently, the command ``b(12)'' will expand to ``stop at 12''.
49543083Scael.Pp
496*50838Scael.It Xo
497*50838Scael.Ic set Ar name
498*50838Scael.Op No \&= Ar expression
499*50838Scael.Xc
50043083ScaelThe
50143083Scael.Ic set
50243083Scaelcommand defines values for debugger variables.
50319720SmckusickThe names of these variables cannot conflict with names in the program
50419720Smckusickbeing debugged, and are expanded to the corresponding expression
50519720Smckusickwithin other commands.
50619720SmckusickThe following variables have a special meaning:
507*50838Scael.Pp
508*50838Scael.Bl -tag -width flag -compact
509*50838Scael.It Li $frame
51043083ScaelSetting this variable to an address causes dbx to use the stack frame
51119720Smckusickpointed to by the address for
51219720Smckusickdoing stack traces and accessing local variables.
51319720SmckusickThis facility is of particular use for kernel debugging.
514*50838Scael.Pp
515*50838Scael.It Li $hexchars
516*50838Scael.It Li $hexints
517*50838Scael.It Li $hexoffsets
518*50838Scael.It Li $hexstrings
51943083ScaelWhen set, dbx prints out
52019720Smckusickout characters, integers, offsets from registers, or character pointers
52119720Smckusickrespectively in hexadecimal.
522*50838Scael.Pp
523*50838Scael.It Li $listwindow
52419720SmckusickThe value of this variable specifies the number
52543083Scaelof lines to list around a function or when the
52643083Scael.Ic list
52743083Scaelcommand
52819720Smckusickis given without any parameters.
52919720SmckusickIts default value is 10.
530*50838Scael.Pp
531*50838Scael.It Li $mapaddrs
53243083ScaelSetting (unsetting) this variable causes dbx to start (stop)
53319720Smckusickmapping addresses.
53419720SmckusickAs with ``$frame'', this is useful for kernel debugging.
535*50838Scael.Pp
536*50838Scael.It Li $unsafecall
537*50838Scael.It Li $unsafeassign
53825878SdonnWhen ``$unsafecall'' is set,
53925878Sdonnstrict type checking is turned off for arguments to
54043083Scaelsubroutine or function calls (
54143083Scael.Ar e .g .
54243083Scaelin the
54343083Scael.Ic call
54443083Scaelstatement).
54525878SdonnWhen ``$unsafeassign'' is set,
54625878Sdonnstrict type checking between the two sides
54743083Scaelof an
54843083Scael.Ic assign
54943083Scaelstatement is turned off.
55025878SdonnThese variables should be used only with great care,
55143083Scaelbecause they severely limit dbx's usefulness
55225878Sdonnfor detecting errors.
553*50838Scael.El
554*50838Scael.Pp
555*50838Scael.It Ic unalias Ar name
55619720SmckusickRemove the alias with the given name.
557*50838Scael.Pp
558*50838Scael.It Ic unset Ar name
55943083ScaelDelete the debugger variable associated with
56043083Scael.Ar name  .
561*50838Scael.El
56243083Scael.Ss Machine Level Commands
563*50838Scael.Pp
564*50838Scael.Bl -tag -width Fl -compact
565*50838Scael.It Xo
566*50838Scael.Ic tracei
56743083Scael.Op Ar address
568*50838Scael.Op Ic \&if Ar cond
569*50838Scael.Xc
570*50838Scael.It Xo
571*50838Scael.Ic tracei
57243083Scael.Op Ar variable
573*50838Scael.Op Ic \&at Ar address
574*50838Scael.Op Ic \&if Ar cond
575*50838Scael.Xc
576*50838Scael.It Xo
577*50838Scael.Ic stopi
57843083Scael.Op Ar address
579*50838Scael.Op Ic \&if Ar cond
580*50838Scael.Xc
581*50838Scael.It Xo
582*50838Scael.Ic stopi
583*50838Scael.Op Ic \&at
58443083Scael.Op Ar address
585*50838Scael.Op Ic \&if Ar cond
586*50838Scael.Xc
58719716SmckusickTurn on tracing or set a stop using a machine instruction address.
588*50838Scael.Pp
589*50838Scael.It Ic stepi
590*50838Scael.It Ic nexti
59143083ScaelSingle step as in
59243083Scael.Ic step
59343083Scaelor
59443083Scael.Ic next  ,
59543083Scaelbut do a single instruction
59619716Smckusickrather than source line.
597*50838Scael.Pp
598*50838Scael.Sm off
599*50838Scael.It Xo
600*50838Scael.Ar address , Ar address / Op Ar mode
601*50838Scael.Xc
602*50838Scael.It Xo
603*50838Scael.Ar address / Op Ar count
604*50838Scael.Sm on
605*50838Scael.Op Ar mode
606*50838Scael.Xc
60743083ScaelPrint the contents of memory starting at the first
60843083Scael.Ar address
60943083Scaeland continuing up to the second
61043083Scael.Ar address
61143083Scaelor until
61243083Scael.Ar count
61343083Scaelitems are printed.
61419720SmckusickIf the address is ``.'', the address following the one
61519716Smckusickprinted most recently is used.
61643083ScaelThe
61743083Scael.Ar mode
61843083Scaelspecifies how memory is to be printed;
61919716Smckusickif it is omitted the previous mode specified is used.
62019716SmckusickThe initial mode is ``X''.
62119716SmckusickThe following modes are supported:
62243083Scael.Pp
623*50838Scael.Bl -tag -width flag -compact
624*50838Scael.It Cm i
625*50838ScaelPrint the machine instruction.
626*50838Scael.It Cm d
627*50838ScaelPrint a short word in decimal.
628*50838Scael.It Cm D
629*50838ScaelPrint a long word in decimal.
630*50838Scael.It Cm o
631*50838ScaelPrint a short word in octal.
632*50838Scael.It Cm O
633*50838ScaelPrint a long word in octal.
634*50838Scael.It Cm x
635*50838ScaelPrint a short word in hexadecimal.
636*50838Scael.It Cm X
637*50838ScaelPrint a long word in hexadecimal.
638*50838Scael.It Cm b
639*50838ScaelPrint a byte in octal.
640*50838Scael.It Cm c
641*50838ScaelPrint a byte as a character.
642*50838Scael.It Cm s
643*50838ScaelPrint a string of characters terminated by a null byte.
644*50838Scael.It Cm f
645*50838ScaelPrint a single precision real number.
646*50838Scael.It Cm g
647*50838ScaelPrint a double precision real number.
648*50838Scael.El
649*50838Scael.El
650*50838Scael.Pp
65119716SmckusickSymbolic addresses are specified by preceding the name with an ``&''.
65219716SmckusickRegisters are denoted by ``$rN'' where N is the number of the register.
65319716SmckusickAddresses may be expressions made up of other addresses and
65419716Smckusickthe operators ``+'', ``-'', and indirection (unary ``*'').
65543083Scael.Ss Miscellaneous Commands
656*50838Scael.Bl -tag -width indent
657*50838Scael.It Ic gripe
65843083ScaelInvoke a mail program to send a message to the person in charge of
65943083Scael.Nm dbx  .
660*50838Scael.It Ic help
66143083ScaelPrint out a synopsis of
66243083Scael.Nm dbx
66343083Scaelcommands.
664*50838Scael.It Ic quit
66543083ScaelExit
66643083Scael.Nm dbx  .
667*50838Scael.It Ic sh Ar command-line
66819716SmckusickPass the command line to the shell for execution.
669*50838ScaelThe
670*50838Scael.Ev SHELL
671*50838Scaelenvironment variable determines which shell is used.
672*50838Scael.It Ic source Ar filename
67343083ScaelRead
67443083Scael.Nm dbx
67543083Scaelcommands from the given
67643083Scael.Ar filename  .
677*50838Scael.El
67843083Scael.Sh ENVIRONMENT
67943083Scael.Nm Dbx
680*50838Scaelexamines the following environment variables:
681*50838Scael.Bl -tag -width indent -compact -offset indent
682*50838Scael.It Ev EDITOR
683*50838Scael.It Ev HOME
684*50838Scael.It Ev PATH
685*50838Scael.It Ev SHELL
686*50838Scael.El
68743083Scael.Sh FILES
688*50838Scael.Bl -tag -width .dbxinit -compact
689*50838Scael.It Pa a.out
690*50838ScaelObject file.
691*50838Scael.It Pa .dbxinit
692*50838ScaelInitial commands.
693*50838Scael.El
69443083Scael.Sh SEE ALSO
69543083Scael.Xr cc 1 ,
69643083Scael.Xr mod l ,
69743083Scael.Xr f77 1 ,
69843083Scael.Xr pc 1
69943083Scael.Sh HISTORY
700*50838ScaelThe
701*50838Scael.Nm dbx
702*50838Scaelcommand appeared in
703*50838Scael.Bx 4.2 .
70443083Scael.Sh BUGS
70543083Scael.Nm Dbx
70643083Scaelsuffers from the same ``multiple include'' malady as did
70743083Scael.Nm sdb  .
70819716SmckusickIf you have a program consisting of a number of object files
70919716Smckusickand each is built from source files that include header files,
71019716Smckusickthe symbolic information for the header files is replicated in
71119716Smckusickeach object file.
71219716SmckusickSince about one debugger start-up is done for each link,
71343083Scaelhaving the linker
71443083Scael.Xr ld 1
71543083Scaelre-organize the symbol information
71619720Smckusickwould not save much time, though it would reduce some of the
71719716Smckusickdisk space used.
71843083Scael.Pp
71919720SmckusickThis problem is an artifact of the unrestricted semantics
72019716Smckusickof #include's in C; for example an include file can contain
72119716Smckusickstatic declarations that are separate entities for each file
72219716Smckusickin which they are included.
72319720SmckusickHowever, even with Modula-2 there is a substantial amount of duplication
72419720Smckusickof symbol information necessary for inter-module type checking.
72543083Scael.Pp
72625878SdonnSome problems remain with the support for individual languages.
72725878SdonnFortran problems include:
72825878Sdonninability to assign to logical, logical*2, complex
72925878Sdonnand double complex variables;
73025878Sdonninability to represent parameter constants
73125878Sdonnwhich are not type integer or real;
73225878Sdonnpeculiar representation for the values of dummy procedures
73325878Sdonn(the value shown for a dummy procedure is actually
73425878Sdonnthe first few bytes of the procedure text;
73525878Sdonnto find the location of the procedure,
73625878Sdonnuse ``&'' to take the address of the variable).
737