Basic Dbx Shell Commands

!! execute the previous command
r execute the previous command
!<num> execute command number
! -<num> execute command <num> before the current
history list a history of dbx commands
. read (source) dbx commands from a file
run start the current process
kill kill the controlled process
debug print name and arguments of program being debugged
debug <prog> [<core>] debug <prog> with corefile <core>(optional)
debug <prog> <pid> attach to process <pid>
detach detaches dbx from the controlled process
runargs <args> set the run arguments for the current program
runargs $\ldots$ [>|>>] <file> output redirection for a program
runargs $\ldots$ < <file> input redirection for a program

Examining Data

print [-r] [-d] <statement> prints <statement>.
  <statement> can be a function call, a local variable, or a constant
  (though not a macro, because the c preprocessor and dbx don't
  work and play well together
-r -r prints inherited members in C++
-d uses dynamic (RTTI) type information to determine the type of
  <statement>
print <arr>[<first>..<last>:<stride>] print an array slice
examine < addr> = [ <fmt> ] display an address in a format
examine <addr 1>, <addr 2> / fmt examine memory in the given format
display <expr> display an expression
undisplay <num> turn off displaying expression number <num>
  (0 turns off all displays)
where display the stack trace.
up move up one stack frame
down move down one stack frame

Formats

i instruction (disassembly)
d,D decimal (2 or 4 bytes)
o,O octal (2 or 4 bytes)
x,X hexadecimal (2 or 4 bytes)
b octal (1 byte)
c character
w wide character
s string
W wide character string
f hex and float (4 bytes, 6 digit prec.)
F hex and float (8 bytes, 14 digit prec.)
g same as `F'
E hex and float (16 bytes, 14 digit prec.)
ld,lD decimal (4 bytes, same as D)
lo,lO octal (4 bytes, same as O)
lx,LX hexadecimal (4 bytes, same as X)
Ld,LD decimal (8 bytes)
Lo,LO octal (8 bytes)
Lx,LX hexadecimal (8 bytes)

Stepping, Stopping, and Tracing

stop <event> <modifier> stop execution when <event> occurs
trace <event> <modifier> print out a message when <event> happens.
tracei <event> <modifier> like above, but works on assembly instructions
when <event> <command> <modifier> execute <command> when <event>happens
dbxenv trace_speed <num> pause <num> seconds between traces
clear [<lineno>] clears events at <lineno> (defaults to current line)
status Print trace's, when's, and stop's in effect
status <hid> print the status of handler (event) <hid>
status -s print all events in a form that dbx can read
  (dbx) status -s > bpts
  $\ldots$
  (dbx) source bpts
delete <num> delete handler <num> (0 deletes all handlers)
handler -disable <num> disables a handler
handler -enable <num> enables a handler
call <proc> <[params]> call <proc> with the given parameters
cont continues execution
cont at <line> <id> continues execution at <line> in lwp <id>
next next instruction (skip calls)
nexti next assembly instruction (skip calls)
step next instruction (enter calls)
stepi next assembly instruction (enter calls)
regs display the registers
dbxenv follow_fork_mode <spec> <spec> can be child, parent, or ask
  if <spec> equals parent, stay with the parent after a call to fork(2)
  if <spec> equals child, follow the child after a call to fork(2)
  if <spec> equals ask, then ask which to follow after a call to fork(2)
assign <var> = <exp> assign <exp> to <var>

Events

in <func> When the program enters <func>
at <line> When <line> in the current file is about to be executed
at <filename>:<line> When <line> in <filename> is about to be executed
inmethod <func> Entry into any method named <func>
infunction <func> Entry into any overloaded version of <func>
inclass <class> Trigger in any member of <class>
inmember <class> Entry into any member function of a class (c++ only)
inobject $<object\ expr>$ Trigger in any member of an instance of a class (c++ only)
modify <addr-expr> [, <size-expr>] Trigger when the address range is written to
throw A C++ exception has been thrown
throw <type> A C++ exception of type <type> has been thrown.

Modifiers

-if <cond> event only fires when <cond> is true
-in <func> event only fires when in <func>
-count <n> count up from 0; fire event and reset counter when nhas been reached
-temp A temporary event. Delete event when fired

Runtime Checking (RTC)

check <type> checks for runtime errors specified by <type> (see below)
check <type> <places> check for runtime errors in <places> where <places>
  is a comma separated list of files, functions, or loadobjects.
  this can be used to focus RTC on specific places.
uncheck <type> stops checking for runtime errors.
showleaks [-v] shows memory leaks (-v for verbose)
showmemuse [-v] shows memory usage (-v for verbose)
suppress History of suppress and unsuppress commands
suppress <errors> Suppress <errors> everywhere.
suppress <errors> <places> Suppress <errors> in <places> where <places>
  is a comma separated list of files, functions, or loadobjects.
unsuppress <errors> Stop suppressing <errors> everywhere.
unsuppress <errors> <places> Stop suppressing <errors> in <places>.

Types of RTC checking

baf Bad free
duf Duplicate free
maf Misaligned free
mar Misaligned read
maw Misaligned write
oom Out of memory
rua Read from unallocated memory
rui Read from uninitialized memory
wro Write to read-only memory
wua Write to unallocated memory
aib Possible memory leak - only pointer points in the middle of the block
air Possible memory leak - pointer to the block exists only in register
mel Memory leak - no pointers to the block

Types of RTC Checking

-access Stops the process whenever a memory access error occurs.
  This checks for baf, duf, maf, mar, maw, oom, rua, rui, wro, wua
  If you set dbxenv rtc_auto to ``on'', then access errors will be
  logged to a file rather than halting execution (controlled by rtc_error_log_filename)
-leaks Generates a list of memory leaks when the program terminates.
  checks for aib, air, mel. The report is not verbose by default,
  controlled by rtc_mel_at_exit. Also, you can use showleaks at any time
-memuse Generates a list of blocks in use when the program terminates. Implies -leaks
  This report is not verbose by default, and controlled by rtc_biu_at_exit
-all Checks for memory usage and leaks



All RTC checking types may be followed by either of the following two options:


-frames <n> Display <n> distinct stack frames when reporting leaks.
-match <m> if two or more errors match <m> or more stack frames, then
  they are reported as one error.

Accessing Source Files

list list the default number of lines in the current file
list <n> list line number <n> in the current file
list +<n> list the next <n> lines in the current file
list <n1>, [+]<n2> list lines from <n1> to <n2> (or the next <n2> lines if +<n2>)
list <filename>:<n> list line <n> in filename.
list -i intermix assembly lines between source lines
list -w list a window of 10 lines.
edit <filename> edit (in $EDITOR) <filename>
edit <proc> edit file containing procedure <proc>
dis <addr> [/<count>] disassemble <count> instructions at <addr>

Miscellaneous Commands

whereis <func> Returns the file containing <func>
whatis <name> returns the type of <name>. Example: ``whatis main'' would
  return ``void main(int argc, char **argv)''
collector collect information about performance.
__cb_prompt A ksh function that gets called before the prompt is displayed
dalias set (or list) a dbx alias
ignore <signal> ignore signal named/numbered <signal>
(un)intercept <typename> (do not) intercept throws of type <typename>
(un)intercept -a (do not) intercept all throws
(un)intercept -x <typename> (Do not) intercept throws of type <typename>(use with above)
(un)intercept list intercepted types

Fix and Continue

fix fix the current file.
fix $<file> \ldots$ Fix list of files
fix -f Force fixing of a file, even if it has not been modified.
fix -a Fix all modified files
fix -g strip -O flags and replace with -g flags
fix -c print compilation line
fix -n no execution (list what would have been done)
fix -v verbose mode
fix +v non-verbose mode
__cb_fix_comp dbxenv variable that controls compilation options
__cb_fix_link dbxenv variable that controls link options
fix_verbose dbxenv variable that printing of the compilation line during a ``fix'' (default off)
fix-pitfalls the section of help that lists ``fix'''s limitations.

Other tips and tricks

pathmap `pathmap' creates a mapping from one pathname to another. The mapping is applied
  to source paths, object file paths and the current working directory (if `-c' is used).
  This may help you if dbx has trouble finding object files
-xs this flag is passed to cc, not dbx. It puts all symbols in the executable, so you don't need
  the .o files to debug.

About this document ...

This document was generated using the LaTeX2HTML translator Version 98.1p1 release (March 2nd, 1998)

Copyright © 1993, 1994, 1995, 1996, 1997, Nikos Drakos, Computer Based Learning Unit, University of Leeds.

The command line arguments were:
latex2html -split 0 -no_navigation dbx_howto.tex.

The translation was initiated by Michael Boilen on 2000-01-31


Michael Boilen
2000-01-31