All rights reserved. The Berkeley software License Agreement
specifies the terms and conditions for redistribution.
@(#)dbx.1 5.1 (Berkeley) 04/29/85
If no objfile is specified, \*(dB looks for a file named ``a.out'' in the current directory. The object file contains a symbol table which 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.
If a file named ``core'' exists in the current directory or a coredump file is specified, \*(dB can be used to examine the state of the program when it faulted.
If the file ``.\*(dBinit'' exists in the current directory then the debugger commands in it are executed. \*(DB also checks for a ``.\*(dBinit'' in the user's home directory if there isn't one in the current directory.
The command line options and their meanings are: .nr In 7
.nr wg 1v .nr vh +\n(wgu \} .nr vk \n(.h \fB-r \c Execute objfile immediately. If it terminates successfully \*(dB exits. Otherwise the reason for termination will be reported and the user offered the option of entering the debugger or letting the program fault. \*(DB will read from ``/dev/tty'' when -r is specified and standard input is not a terminal.
.nr wg 1v .nr vh +\n(wgu \} .nr vk \n(.h \fB-i \c Force \*(dB to act as though standard input is a terminal.
.nr wg 1v .nr vh +\n(wgu \} .nr vk \n(.h \fB-I dir \c Add dir to the list of directories that are searched when looking for a source file. Normally \*(dB looks for source files in the current directory and in the directory where objfile is located. The directory search path can also be set with the use command.
.nr wg 1v .nr vh +\n(wgu \} .nr vk \n(.h
Unless -r is specified, \*(dB just prompts and waits for a command. Execution and Tracing Commands
run [args] [< filename] [> filename] Start executing objfile, passing args as command line arguments; < or > can be used to redirect input or output in the usual manner. If objfile has been written since the last time the symbolic information was read in, \*(dB will read in the new information.
trace [in procedure/function] [if condition] .ns
trace source-line-number [if condition] .ns
trace procedure/function [in procedure/function] [if condition] .ns
trace expression at source-line-number [if condition] .ns
trace variable [in procedure/function] [if condition] 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 delete command). The first argument describes what is to be traced. If it is a source-line-number, then the line is printed 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. "mumble.p":17. 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. If the argument is an expression with an at clause 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. The clause ``in procedure/function'' restricts tracing information to be printed only while executing inside the given procedure or function. Condition is a boolean expression and is evaluated prior to printing the tracing information; if it is false then the information is not printed.
Displaying and Naming Data
Accessing Source Files
Machine Level Commands
tracei [address] [if cond] .ns
tracei [variable] [at address] [if cond] .ns
stopi [address] [if cond] .ns
stopi [at] [address] [if cond] Turn on tracing or set a stop using a machine instruction address.
stepi .ns
nexti Single step as in step or next, but do a single instruction rather than source line.
address ,address/ [mode] .ns
[address] / [count] [mode] Print the contents of memory starting at the first address and continuing up to the second address or until count items are printed. If no address is specified, the address following the one printed most recently is used. The mode 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: .nr In 5
.nr wg 1v .nr vh +\n(wgu \} .nr vk \n(.h \fBi \c print the machine instruction
.nr wg 0v .nr vh +\n(wgu \} .nr vk \n(.h \fBd \c print a short word in decimal
.nr wg 0v .nr vh +\n(wgu \} .nr vk \n(.h \fBD \c print a long word in decimal
.nr wg 0v .nr vh +\n(wgu \} .nr vk \n(.h \fBo \c print a short word in octal
.nr wg 0v .nr vh +\n(wgu \} .nr vk \n(.h \fBO \c print a long word in octal
.nr wg 0v .nr vh +\n(wgu \} .nr vk \n(.h \fBx \c print a short word in hexadecimal
.nr wg 0v .nr vh +\n(wgu \} .nr vk \n(.h \fBX \c print a long word in hexadecimal
.nr wg 0v .nr vh +\n(wgu \} .nr vk \n(.h \fBb \c print a byte in octal
.nr wg 0v .nr vh +\n(wgu \} .nr vk \n(.h \fBc \c print a byte as a character
.nr wg 0v .nr vh +\n(wgu \} .nr vk \n(.h \fBs \c print a string of characters terminated by a null byte
.nr wg 0v .nr vh +\n(wgu \} .nr vk \n(.h \fBf \c print a single precision real number
.nr wg 0v .nr vh +\n(wgu \} .nr vk \n(.h \fBg \c print a double precision real number
.nr wg 1v .nr vh +\n(wgu \} .nr vk \n(.h
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 ``*'').
Miscellaneous Commands
source filename Read \*(dB commands from the given filename. Especially useful when the filename has been created by redirecting a status command from an earlier debugging session.
.nr wg 1v .nr vh +\n(wgu \} .nr vk \n(.h a.out \c object file
.nr wg 0v .nr vh +\n(wgu \} .nr vk \n(.h \&.\*(dBinit \c initial commands
.nr wg 0v .nr vh +\n(wgu \} .nr vk \n(.h
\*(DB suffers from the same ``multiple include'' malady as does sdb. 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 each object file. Since about one debugger start-up is done for each link, having the linker (ld) re-organize the symbol information won't save much time, though it would reduce some of the disk space used. The 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.