DBX(1) DBX(1)
NAME
dbx - source-level debugger
SYNOPSIS
dbx [-I -c file -i -r] [object file] [core file]
DESCRIPTION
Dbx, a source-level debugger, runs under the Berkeley (4.3
BSD) and System V (V.3) versions of the UNIX system. This
enhanced version of dbx works with cc(1), f77(1), pc(1),
as(1), and MIPS machine code.
The object file used with the debugger is produced by
specifying an appropriate option (usually `-g') to the
compiler. The resulting object file contains symbol table
information, including the names of all source files that
the compiler translated to create the object file. These
source files are accessible from the debugger.
If a coredump file is specified, or the file core exists in
the current directory, dbx can be used to look at the state
of the program when it faulted.
Running dbx
If a .dbxinit file resides in the current directory or in
the user's home directory, the commands in it are executed
when dbx is invoked.
When invoked, dbx recognizes these command line options:
-I directory
Tells dbx to look in the specified directory for
source files. Multiple directories can be specified
by using multiple -I options. Dbx searches for
source files in the current directory and in the
object file's directory whether or not -I is used.
-c file Selects a command file other than .dbxinit.
-i Uses interactive mode. This option does not treat
#s as comments in a file. It prompts for source
even when it reads from a file. With this option,
dbx also has extra formatting as if for a terminal.
-r Runs the object file immediately.
Multiple commands can be specified on the same command line
by separating them with a semicolon (;).
The Monitor
Page 1 (last mod. 8/20/87)
DBX(1) DBX(1)
These commands control the dbx monitor:
![string] [integer] [-integer]
Specifies a command from the history list.
help Prints a list of dbx commands, using the UNIX system
more command to display the list.
history Prints the items from the history list. The default
if 20.
quit Exits dbx.
Controlling dbx
alias [name(arg1,...argN)"string"]
Lists all existing aliases, or, if an argument is
specified, defines a new alias.
unalias alias command_name
Removes the specified alias.
delete expression1, ...expressionN
delete all
Deletes the specified item from the status list.
The argument all deletes all items from the status
list.
playback input [file]
Replays commands that were saved with the record
input command in a text file.
playback output [file]
Replays debugger output that was saved with the
record output command.
record input [file]
Records all commands typed to dbx.
record output [file]
Records all dbx output.
sh [shell command]
Calls a shell from dbx or executes a shell command.
status Lists currently set stop, record, and trace
commands.
set [variable = expression]
Lists existing debugger variables and their values.
This command can also be used to assign a new value
to an existing variable or to define a new variable.
Page 2 (last mod. 8/20/87)
DBX(1) DBX(1)
unset variable
Removes the setting from a specified debugger
variable.
Examining Source
/regular expression
Searches ahead in the source code for the regular
expression.
?regular expression
Searches back in the source code for the regular
expression.
edit [file]
Calls an editor from dbx.
file [file]
Prints the current file name, or, if a file name is
specified, this command changes the current file to
the specified file.
func [expression] [procedure]
Moves to the specified procedure (activation level),
or, if an expression or procedure isn't specified,
prints the current activation level.
list [expression:integer]
list [expression]
Lists the specified lines. The default is 10 lines.
use [directory1 ... directoryN]
Lists source directories, or, if a directory name is
specified, this command substitutes the new
directories for the previous list.
whatis variable
Prints the type declaration for the specified name.
which variable
Finds the variable name currently being used.
whereis variable
Prints all qualifications (the scopes) of the
specified variable name.
Controlling Programs
assign expression1 = expression2
Assigns the specified expression to a specified
program variable.
Page 3 (last mod. 8/20/87)
DBX(1) DBX(1)
cont in procedure
cont to line
cont signal to line
cont signal in procedure
Continues executing a program after a breakpoint.
goto line
Goes to the specified line in the source.
next [integer]
Steps over the specified number of lines. The
default is one. This command does not step into
procedures.
rerun [arg1 ... argN] [<file1][>file2]
Reruns the program, using the same arguments that
were specified to the run command. If new arguments
are specified, rerun uses those arguments.
run [arg1 ... argN] [<file1] [>file2]
Runs the program with the specified arguments.
return [procedure]
Continues executing until the procedure returns. If
a procedure isn't specified, dbx assumes the next
procedure.
step [integer]
Steps the specified number of lines. This command
steps into procedures. The default is one line.
Setting Breakpoints
catch [signal]
Lists all signals that dbx catches, or, if an
argument is specified, adds a new signal to the
catch list.
ignore [signal]
Lists all signals that dbx does not catch. If a
signal is specified, this command adds the signal to
the ignore list.
stop [variable]
stop [variable] at line [if expression]
stop [variable] in procedure [if expression]
Page 4 (last mod. 8/20/87)
DBX(1) DBX(1)
stop [variable] if expression
Sets a breakpoint at the specified point.
trace variable [at line [if expression]
trace variable [in procedure [if expression]
Traces the specified variable.
when [variable] [at line] {command_list}
when [variable] [f3in procedure] {command_list}
Executes the specified dbx comma separated command
list.
Examining Program State
dump [procedure] [.]
Prints variable information about the procedure. If
a dot (.) is specified, this command prints global
variable information for all procedures.
down [expression]
Moves down the specified number of activation levels
in the stack. The default is one level.
up [expression]
Moves up the specified number of activation levels
on the stack. The default is one.
print expression1,...expressionN
Prints the value of the specified expression.
printf "string", expression1,...expressionN
Prints the value of the specified expression, using
C language string formatting.
printregs
Prints all register values.
where Does a stack trace, which shows the current
activation levels.
Debugging at the Machine Level
conti signal to address
conti signal in procedure
conti signal to address
conti signal in procedure
Page 5 (last mod. 8/20/87)
DBX(1) DBX(1)
Continues executing assembly code after a
breakpoint.
nexti [integer]
Steps over the specified number of machine
instructions. The default is one. This command
does not step into procedures.
stepi [integer]
Steps the specified number of machine instructions.
This command steps into procedures. The default is
one instruction.
stopi [variable] at address [at address [if expression]
stopi [variable] in procedure [if expression]
stopi [variable] if expression
Sets a breakpoint in the machine code at the
specified point.
tracei variable at address[at address if expression]
tracei variable in procedure [at address if expression]
Traces the specified variable in machine
instructions.
address/<count><mode>
Prints the contents of the specified address or
disassembles the code for the instruction at the
specified address.
Predefined dbx Variables
The debugger has these predefined variables:
$listwindow
Specifies how many lines the list command lists.
$datacache
Caches information from the data space so that dbx
only has to check the data space once. To debug the
operating system, set this variable to 0; otherwise,
set it to a nonzero value.
$main Specifies the name of the procedure that dbx will
start with. This can be set to any procedure.
$pagewindow
Specifies how many lines print when information runs
longer than one screen. This can be changed to match
the number of lines on any terminal. If set to 0,
this variable assumes one line.
Page 6 (last mod. 8/20/87)
DBX(1) DBX(1)
$page Specifies whether to page long information. A
nonzero value turns on paging; a 0 turns it off.
$maxstrlen
Specifies how many characters of a string that dbx
will print for pointers to strings.
$curscline
Shows the las line listed plus 1.
$historyevent
Shows the current history line.
$curevent
Shows the last even number as seen in the status
feature.
$pimode Prints input when used with the playback input
command.
$romode REcords input when used with the record output
command.
$defaultout
Shows the name of the file that dbx uses to store
information when the record output command is set.
$defaultin
Shows the name of the file that dbx uses to store
information when the record input command is set.
$addrfrmt
Specifies the format for addresses. This can be set
to anything that can a C printf statement can
format.
$prompt Sets the prompt for dbx
$curline
Shows the current line in the source code.
$hexstrings
Specifies whether you want to print all strings in
hexadecimal. A 1 means use hexadecimal; a 0 means
use characters.
$hexints
Changes the default output constants to hexadecimal
when set to a non-zero value. Hexadecimal overrides
octal.
Page 7 (last mod. 8/20/87)
DBX(1) DBX(1)
$octints
Changes the default output constants to octal when
set to a non-zero value. Hexadecimal overrides
octal.
$hexchars
Specifies whether you want to see all characters in
hexadecimal. A non-zero value specifies
hexadecimal. Hexadecimal overrides octal.
$hexint Changes the default input constants to hexadecimal
when set to a non-zero value. Hexadecimal overrides
octal.
$octin Changes the default input constants to octal when
set to a non-zero value. Hexadecimal overrides
octal.
Predefined dbx Aliases
The debugger has these predefined aliases:
a Assigns a value to a program variable.
b Sets a breakpoint at a specified line.
bp Stops in a specified procedure.
c Continues program execution after a breakpoint.
d Deletes the specified item from the status list.
e Looks at the specified file.
f Moves to the specified activation level on the
stack.
g Goes to the specified line and begins executing the
program there.
h Lists all items currently on the history list.
j Shows what items are on the status list.
l Lists the next 10 lines of source code.
n or S Step over the specified number of lines without
stepping into procedure calls.
ni or Si
Step over the specified number of assembly code
instructions without stepping into procedure calls.
Page 8 (last mod. 8/20/87)
DBX(1) DBX(1)
p Prints the value of the specified expression or
variable.
pd Prints the value of the specified expression or
variable in decimal.
pi Replays dbx commands that were saved with the record
input command.
po Prints the value of the specified expression or
variable in octal.
pr Prints values for all registers. px Prints the value
fo the specified variable or expression in
hexadecimal.
q Ends the debugging session.
r Runs the program again with the same arguments that
were specified with the run command.
ri Records in a file every command typed.
ro Records all debugger output in the specified file.
s Steps the next number of specified lines.
si Steps the next number of specified loines of
assembly code instructions.
t Does a stack trace.
u Lists the previous 10 lines.
w Lists the 5 lines preceding and following the
current line.
W Lists the 10 lines preceding and following the
current line.
SEE ALSO
MIPS Languages Programmer Guide.
ORIGIN
MIPS Computer Systems
Page 9 (last mod. 8/20/87)