.\" Copyright (c) 1983, 1990 The Regents of the University of California.
.\" %sccs.include.redist.man%
.\" @(#)dbx.1 6.4 (Berkeley) %G%
.Op Ar objfile Op Ar coredump
is a tool for source level debugging and execution of
is an object file produced by a compiler
with the appropriate flag (usually
specified to produce symbol information in the object file.
Research Laboratory Modula-2 compiler,
produce the appropriate source information.
The machine level facilities of
can be used on any program.
The object file contains a symbol table that includes the name of the
all the source files translated by the compiler to create it.
These files are available for perusal while using the debugger.
exists in the current directory
to examine the state of the program when it faulted.
If the file ``.dbxinit'' exists in the current directory then the
debugger commands in it are executed.
also checks for a ``.dbxinit'' in the user's home directory
if there isn't one in the current directory.
The command line options and their meanings are:
If it terminates successfully
Otherwise the reason for termination will be reported
and the user offered the option of entering the debugger
or letting the program fault.
will read from ``/dev/tty'' when
and standard input is not a terminal.
to act as though standard input is a terminal.
Map memory addresses, useful for kernel debugging.
to the list of directories
that are searched when looking for a source file.
looks for source files in the current directory
and in the directory where
The directory search path can also be set with the
reading from standard input.
just prompts and waits for a command.
.Ss Execution and Tracing Commands
as command line arguments;
can be used to redirect input or output in the usual manner.
is used without any arguments the previous
argument list is passed to the program;
otherwise it is identical to
has been written since the last time the symbolic information
will read in the new information.
.Op Ic in Ar procedure/function
.Op Ic in Ar procedure/function
.Op Ic in Ar procedure/function
Have tracing information printed when the program is executed.
A number is associated with the command that is used
to turn the tracing off (see the
The first argument describes what is to be traced.
immediately prior to being executed.
Source line numbers in a file other than the current one
must be preceded by the name of the file in quotes and a colon, e.g.
If the argument is a procedure or function name then
every time it is called, information is printed telling
what routine called it, from what source line it was called,
and what parameters were passed to it.
In addition, its return is noted, and if it's a function
then the value it is returning is also printed.
then the value of the expression is printed whenever the
identified source line is reached.
If the argument is a variable then the name and value of the variable
is printed whenever it changes.
Execution is substantially slower during this form of tracing.
If no argument is specified then all source lines are printed
before they are executed.
Execution is substantially slower during this form of tracing.
restricts tracing information
to be printed only while executing inside the given procedure
is a boolean expression and is
evaluated prior to printing the tracing information;
if it is false then the information is not printed.
Stop execution when the given line is reached, procedure or function
called, variable changed, or condition true.
Print out the currently active
The traces or stops corresponding to the given numbers are removed.
The numbers associated with traces and stops are printed by
Start or stop trapping a signal before it is sent
This is useful when a program being debugged
handles signals such as interrupts.
A signal may be specified by number or by a name
Signal names are case insensitive and the ``SIG'' prefix is optional.
By default all signals are trapped except SIGCONT, SIGCHILD,
Continue execution from where it stopped.
If a signal is specified, the process continues as though
Otherwise, the process is continued as though it had not been stopped.
Execution cannot be continued if the process has ``finished'',
that is, called the standard procedure ``exit''.
does not allow the process to exit, thereby
letting the user to examine the program state.
Execute up to the next source line.
The difference between this and
if the line contains a call to a procedure or function
command will stop at the beginning of that
Continue until a return to
until the current procedure returns if none is specified.
.Ar procedure (parameters )
Execute the object code associated with the named procedure or function.
.Ss Printing Variables and Expressions
Names are resolved first using the static scope of the current function,
then using the dynamic scope if the name is not defined
If static and dynamic searches do not yield a result,
an arbitrary symbol is chosen and
.Op using Ar qualified name
The name resolution procedure may be overridden by qualifying an identifier
For C, source files are treated as modules named
by the file name without ``.c''.
Expressions are specified with an approximately
common subset of C and Pascal (or equivalently Modula-2) syntax.
Indirection can be denoted using either a prefix ``*'' or
array expressions are subscripted by brackets
The field reference operator (``.'') can be used with pointers
as well as records, making the C operator ``\->'' unnecessary
(although it is supported).
Types of expressions are checked;
the type of an expression may be overridden
.Ar type-name (expression)
When there is no corresponding named type
can be used to represent a pointer to a named type or C structure tag.
Assign the value of the expression to the variable.
Print the names and values of variables in the given procedure,
or the current one if none is specified.
If the procedure given is ``.'', then the all active variables
.Op Ic \&, Ar expression ...
Print out the values of the expressions.
Print the declaration of the given name, which may be qualified
with block names as above.
Print the full qualification of the given identifer, i.e.
the outer blocks that the identifier is associated with.
Move the current function, which is used for resolving names,
Print out a list of the active procedures and function.
Print the full qualification of all the symbols whose
name matches the given identifier.
The order in which the symbols are printed is not meaningful.
.Ss Accessing Source Files
.Dp Cx Ar /regular expression
.Dp Cx Ar ?regular expression
Search forward or backward in the current source file
.Ar procedure/function-name
or the current source file if none
the editor is invoked on the file that contains it.
Which editor is invoked by default depends on the installation.
The default can be overridden by setting the environment variable
to the name of the desired editor.
Change the current source file name to
If none is specified then the current source file name is printed.
.Op Ar procedure/function
Change the current function.
If none is specified then print the current function.
Changing the current function implicitly changes the current source file
to the one that contains the function; it also changes the current scope
used for name resolution.
.Op Ar source-line-number Op Ic \&, Ar source-line-number
List the lines in the current source file from the first line number to
If no lines are specified, the next 10 lines are listed.
If the name of a procedure or function is given
in the procedure or function and
Set the list of directories to be searched
when looking for source files.
.Ss Command Aliases and Variables
When commands are processed,
dbx first checks to see if the word
is an alias for either a command or a string.
If it is an alias, then dbx treats the input as though
the corresponding string (with values substituted for any parameters)
to define an alias ``rr'' for the command ``rerun'',
To define an alias called ``b'' that sets a stop at a particular line
.Dl alias b(x) ``stop at x''
Subsequently, the command ``b(12)'' will expand to ``stop at 12''.
command defines values for debugger variables.
The names of these variables cannot conflict with names in the program
being debugged, and are expanded to the corresponding expression
The following variables have a special meaning:
Setting this variable to an address causes dbx to use the stack frame
pointed to by the address for
doing stack traces and accessing local variables.
This facility is of particular use for kernel debugging.
out characters, integers, offsets from registers, or character pointers
respectively in hexadecimal.
The value of this variable specifies the number
of lines to list around a function or when the
is given without any parameters.
Setting (unsetting) this variable causes dbx to start (stop)
As with ``$frame'', this is useful for kernel debugging.
When ``$unsafecall'' is set,
strict type checking is turned off for arguments to
subroutine or function calls (
When ``$unsafeassign'' is set,
strict type checking between the two sides
These variables should be used only with great care,
because they severely limit dbx's usefulness
Remove the alias with the given name.
Delete the debugger variable associated with
.Ss Machine Level Commands
Turn on tracing or set a stop using a machine instruction address.
but do a single instruction
Print the contents of memory starting at the first
and continuing up to the second
If the address is ``.'', the address following the one
printed most recently is used.
specifies how memory is to be printed;
if it is omitted the previous mode specified is used.
The initial mode is ``X''.
The following modes are supported:
print the machine instruction
print a short word in decimal
print a long word in decimal
print a short word in octal
print a long word in octal
print a short word in hexadecimal
print a long word in hexadecimal
print a byte as a character
print a string of characters terminated by a null byte
print a single precision real number
print a double precision real number
Symbolic addresses are specified by preceding the name with an ``&''.
Registers are denoted by ``$rN'' where N is the number of the register.
Addresses may be expressions made up of other addresses and
the operators ``+'', ``-'', and indirection (unary ``*'').
.Ss Miscellaneous Commands
Invoke a mail program to send a message to the person in charge of
Pass the command line to the shell for execution.
The SHELL environment variable determines which shell is used.
checks these environment variables:
suffers from the same ``multiple include'' malady as did
If you have a program consisting of a number of object files
and each is built from source files that include header files,
the symbolic information for the header files is replicated in
Since about one debugger start-up is done for each link,
re-organize the symbol information
would not save much time, though it would reduce some of the
This problem is an artifact of the unrestricted semantics
of #include's in C; for example an include file can contain
static declarations that are separate entities for each file
in which they are included.
However, even with Modula-2 there is a substantial amount of duplication
of symbol information necessary for inter-module type checking.
Some problems remain with the support for individual languages.
Fortran problems include:
inability to assign to logical, logical*2, complex
and double complex variables;
inability to represent parameter constants
which are not type integer or real;
peculiar representation for the values of dummy procedures
(the value shown for a dummy procedure is actually
the first few bytes of the procedure text;
to find the location of the procedure,
use ``&'' to take the address of the variable).