Online Help for the Dbx Debugger

dbx: Workshop 4.0 10/15/96 [dbx 4.0]

Command Summary

Use `commands' to see a command summary consisting of one-line descriptions of each dbx command. Execution and Tracing cancel catch clear cont delete fix fixed handler ignore intercept next pop replay rerun restore run runargs save status step stop trace unintercept when whocatches Displaying and Naming Data assign call dis display down dump examine exists frame hide print undisplay unhide up whatis where whereami whereis which Accessing Source Files bsearch cd edit file files func funcs line list loadobject loadobjects module modules pathmap pwd search Debugging Multiple Threads lwp lwps thread threads Runtime Checking check showblock showleaks showmemuse suppress uncheck unsuppress Miscellaneous collector commands dalias dbxenv debug detach document help history import kalias kill language mmapfile quit setenv sh source ! !! GUI Interface to dbx button unbutton Machine Level adb examine listi nexti registers regs stepi stopi tracei wheni Language Specific Information Help Topics c++ ObjC Other Help Topics alias array-slicing callbacks changes changes301 changes31 changes32 collectormt .dbxrc dbx editing environment events FAQ fix-pitfalls follow-fork format forwardref invocation ksh lwpid MT options path prettyprint redirection registers rtc scope signals startup tid The command `help <cmdname>' provides additional help for each command or topic. For new and changed features, see `help changes', and `help FAQ' for answers to frequently asked questions about dbx.

One-line Summary of Each Command

dbx commands: adb Execute an `adb-style' command or enter `adb' mode assign Assign a new value to a program variable bsearch Search backward in the current source file button Define a new button for the WorkShop Custom Buttone window call Call a procedure cancel Cancel the current signal catch Catch the given signal(s) check Enable checking of memory access, leaks, or usage (RTC) clear Clear breakpoints collector Collect performance data commands List all built-in commands with one-line descriptions cont Cause the process to continue execution dbxdebug Displays internal state of dbx (for dbx developers' use) dbxenv List or set dbx customization variables debug List or change the program being debugged delete Delete breakpoints and other events detach Release the target process from dbx's control dis Disassemble machine instructions display Evaluate and print expressions at every stopping point document Add help information for a command or topic down Move down the call stack (away from `main') dump Print all variables local to a procedure edit Invoke $EDITOR on a source file (or display the source when using the GUI) examine Show memory contents exception Print the value of the current C++ exception exists Check for existence of a symbol name file List or change the current file files List file names that match a regular expression fix Recompile and relink a source file fixed List names of all `fixed' files frame List or change the current stack frame number func List or change the current function funcs List all function names that match a regular expression handler Modify event handlers (enable, disable, etc.) help Provide more information about a command or topic hide Hide stack frames that match a regular expression history Manipulate the command history list ignore Don't catch the given signal(s) import Import commands from a dbx command library intercept Intercept throws (C++ exceptions) of the given type. Can only be language List or change the current source language line List or change the current line number list Display lines of a source file listi Display source and disassembled instructions loadobject Print the name of the current loadobject loadobjects List loadobject names lwp List or change the current LWP lwps List all LWPs in the process mmapfile mmap a file that was mmapped during a core dump module Read debugging information for one or more modules modules List module names next Step one source line (stepping over calls) nexti Step one machine instruction (stepping over calls) pathmap Map one pathname to another for finding source files, etc. pop Remove one or more frames from the callstack print Print the value of an expression prog Manage programs being debugged and their attributes quit Exit dbx regs Print current value of registers replay Replay debugging commands since last `run' rerun Run the program with no arguments restore Restore dbx to a previously saved state rprint Print an expression using shell quoting rules run Run the program with arguments runargs Change the arguments of the target process save Save commands to a file scopes Print list of active scopes search Search forward in the current source file setenv Set an environment variable showblock Show where the particular heap block was allocated from (RTC) showleaks Report new memory leaks since last `showleaks' command (RTC) showmemuse Show memory used since last `showmemuse' command (RTC) source Execute commands from a given file status List event handlers (breakpoints, etc.) step Step one source line or statement (stepping into calls) stepi Step one machine instruction (stepping into calls) stop Set a source-level breakpoint stopi Set a machine-level breakpoint suppress Suppress reporting of memory errors (RTC) thread List or change the current thread threads List all threads trace Show executed source lines, function calls, or variable changes tracei Show machine instructions, function calls, or variable changes unbutton Remove GUI buttons uncheck Disable checking of memory access, leaks, or usage (RTC) undisplay Undo `display' commands unhide Undo `hide' commands unintercept Undo `intercept' commands. Valid only with C++. unsuppress Undo `suppress' commands (RTC) up Move up the call stack (toward `main') use List or change the directory search path vitem Data Visualization interface whatis Print type of expression or declaration of type where Print the call stack whereami Display the current source line whereis Print all uses of a given name, or symbolic name of an address which Print the full qualification of a given name whocatches Tell where a C++ exception would be caught ksh commands: . Read commands from a file : No-op [ `[ <expr> ]' is shorthand for `test <expr>' bg Put a job into the background bind Display or modify the emacs editing key bindings break Break out of `while', `until', or `for' loop builtin Use builtin version of command, ignoring functions and aliases cd Change the working directory continue Go to next iteration of `while', `until', or `for' loop dalias Define a dbx-style (csh-style) alias eval Evaluate text as a command exec Execute a new program (terminate dbx) exit Exit dbx export Mark given environment variables to be exported false Does nothing and returns non-zero fc (Fix Command) Manipulate history list fg Put a job into the foreground getopts Parse positional parameters for options hash Manipulate tracked aliases (fast command lookup) jobs List all active jobs kalias Define a ksh-style alias kill Send a signal to a process; kill the target process kprint (Korn print) Echo the arguments let Evaluate ksh arithmetic expressions read Read a line from a file or standard input readonly Mark environment variables unchangeable return Return from a ksh function set Set ksh options or positional parameters sh Execute a command explicitly from $PATH shift Shift the positional parameters test Check various file attributes, string comparison, etc. times Print accumulated user and system times for dbx and children trap Associate ksh commands with signals or process exit true Does nothing and returns zero typeset Set attributes of environment variables ulimit List or change various resource limits umask Restrict read/write/execute permissions for new files unalias Remove alias definition unset Remove definition of environment variables wait Wait for background jobs to terminate whence Display meaning of name (alias, function, builtin, command) ksh keywords: case Multiway branching: case <string> in <cases> esac do Command grouping: while <test> do <cmds> done done Command grouping: while <test> do <cmds> done elif Conditional execution: if then elif else fi else Conditional execution: if then elif else fi esac Multiway branching: case <string> in <cases> esac fi Conditional execution: if then elif else fi for Loop over a list: for <var> in <list> do <cmds> done function Define a ksh function: function <name> { <cmds> } if Conditional execution: if then elif else fi in for ... in ... do ... done or case ... in ... esac select Selection loop: select <var> in <list> do <cmds> done then Conditional execution: if then elif else fi time Report user and system times: time <cmd> until Loop until condition is true: until <test> do <cmds> done when Execute commands on given event wheni Execute commands on given low-level event while Loop while condition is true: while <test> do <cmds> done { Command grouping: { <cmd>; <cmd>; } } Command grouping: { <cmd>; <cmd>; }

Individual Help Topics


!

!! # Execute previous command !<num> # Execute command number <num> !-<num> # Execute current command-number minus <num> !<str> # Execute most recent command starting with <str> Modifiers: :s/<l>/<r>/ # Substitute modifier: Substitute <r> for <l> :p # Print modifier: Print but do not execute the command Abbreviations: ^<l>^<r>^ # Quick substitution: Substitute <r> for <l>


!!

!! # Execute previous command !<num> # Execute command number <num> !-<num> # Execute current command number minus <num> !<str> # Execute most recent command starting with <str> Modifiers: :s/<l>/<r>/ # Substitute modifier: Substitute <r> for <l> :p # Print modifier: Print but do not execute the command Abbreviations: ^<l>^<r>^ # Quick substitution: Substitute <r> for <l>


$db

adb <adb-cmd>


.

The `. <file>' command causes dbx to read commands from <file>. Any variable assignments and function definitions affect the current environment. $PATH is searched if the `path' option is set. See also `help source' and `help ksh options'.


.dbxrc

# If no .dbxrc file is found by dbx during startup, dbx switches into # '.dbxinit compatibility mode', which means that dbx automatically aliases `alias' # to `dalias' and reads your .dbxinit file. See `help alias' and `help startup' # for more information. (This is for backward compatibility and may not be # supported in future releases.) # You can prevent the startup message: # # Using .dbxinit compatibility mode. See `help .dbxrc' for more information. # # by creating a .dbxrc file. To populate it with the contents of this help topic, # use the command: # help .dbxrc >$HOME/.dbxrc # To enable a useful set of options, use: # help .dbxrc | sed 's/^##/ /' >$HOME/.dbxrc # Then: # source $HOME/.dbxrc # The .dbxrc file uses KornShell syntax; old-style dbx aliases do not # work in a .dbxrc file. To convert your old .dbxinit file: # # (1) Append the contents of your .dbxinit to your .dbxrc. # (2) Remove (or rename) your .dbxinit file. # (3) Change `alias foo bar baz' to `dalias foo bar baz', or # `alias foo bar baz' to `alias foo="bar baz"' # # If you routinely use newer and older releases of dbx, you might # wish to retain your .dbxinit file and add uses of new functionality to # a .dbxrc file which `sources' your .dbxinit. To read in the existing # .dbxinit file, if any, you must assume that old-style aliases # may be found, so we must temporarily redefine `alias'. kalias alias=dalias if [ -r .dbxinit ] then source .dbxinit elif [ -r $HOME/.dbxinit ] then source $HOME/.dbxinit fi kalias alias=kalias # The following section provides the typical entries in a .dbxrc file: # set +o path # uncomment this line to disable $PATH searching ## set -o ignoresuspend # uncomment to cause dbx to ignore ^Z ## set -o emacs # uncomment to enable emacs-style command editing # set -o vi # uncomment this line for vi-style editing ## dbxenv output_short_file_name on # print short pathnames for files ## dbxenv scope_look_aside on # find file static symbols even when not in scope ## dbxenv output_dynamic_type on # cause `-d' to be the default for printing # and displaying (C++) # dbxenv stack_verbose off # suppress printing of arguments and line numbers # in `where' (improves performance) ## button ignore step up # add `step up' button to GUI # Uncomment the following two lines to enable dbx journaling. # This can help Sun support personnel diagnose bugs in the field. # # import /opt/SUNWspro/lib/debugging.so >/dev/null # log -default -start # Useful aliases: # ## kalias alias=kalias # ensure that KSH alias syntax is used ## alias n=next ## alias N=nexti ## alias s=step ## alias S=stepi ## alias su="step up" ## alias c=cont ## alias p=print ## alias q=quit ## alias w=where ## alias si="stop in" ## alias sa="stop at" ## alias sm="stop modify" ## alias sr="stop returns" ## alias sif="stop infunction" ## alias sim="stop inmember" ## alias sic="stop inclass" ## alias en="handler -enable" ## alias di="handler -disable" ## alias wi=whatis ## alias l=list ## alias u=up ## alias d=down ## alias h=history ## alias f=frame ## alias goto="stop at !:1 -temp; cont" ## button lineno goto # Useful functions: ## function hex # print arg in hex ## { ## : ${1?"usage: $0 <expr> # print <expr> in hex"} ## typeset -i16 x ## ((x = $[(int)$*])) ## echo - $* = $x ## } ## typeset -q hex ## function pp # print pointer; print expression as symbolic ## { # address and hex value ## : ${1?"usage: $0 <expr> # print expr as symbolic address and hex value"} ## builtin examine $[(int)$*]/X ## } ## typeset -q pp ## function offsetof # print offset of $2 in type $1: offsetof strct fld ## { ## : ${2?"usage: $0 <structname> <fieldname> # offset of fld in struct"} ## [ -z "$3" ] || { echo "$0: unexpected argument" >&2 && return; } ## echo - $[(int)(&((($1*)0)->$2))] ## } ## alias off=offsetof ## function environment # dump the environment variables of the target process ## { ## [ -z "$1" ] || { echo "$0: unexpected argument" >&2 && return; } ## typeset -i i=0 ## typeset env="((char **)$[(char**)environ])" ## while : ## do ## x=$[($env)[$i]] ## echo "$i: " "${x#0x*\ }" ## case "$x" in ## *\(nil\)*) break;; ## esac ## ((i += 1)) ## done ## } ## function hexdump # dump $2 (default: sizeof $1) bytes in hex ## { ## : ${1?"usage: $0 <exp> [<size>] # dump <size> bytes in hex"} ## typeset -i16 p="$[(void *)&$1]" # address of $1 ## typeset -i s="${2:-$[sizeof ($1)]}" >/dev/null 2>&1 # number of bytes ## ## builtin examine $p/$[(${s:-4}+3)/4]X ## } ## typeset -q hexdump ## alias hd=hexdump ## button literal hexdump # uncomment to install GUI button ## if $havegui ## then ## SMSO= # can't use reverse video in GUI ## RMSO= ## else ## SMSO=$(tput smso) # start standout mode (reverse video) ## RMSO=$(tput rmso) # end standout mode ## fi ## PS1="$SMSO(dbx !)$RMSO " # reverse-video prompt with history number # Example of the _cb_prompt callback routine (see `help callbacks') # function _cb_prompt # { # if $mtfeatures # then # set prompt for MT debugging # PS1='${SMSO}${thread} ${lwp} <!>${RMSO} ' # else # set prompt for non-thread debugging # PS1='${SMSO}dbx<!>${RMSO} ' # fi # }


/

The `/' command is obsolete; please see `help changes301'.


:

The `:' command does nothing and returns 0 (true).


=

The `=' command is obsolete; please see `help changes301'.


?

The `?' command is obsolete; please see `help changes301'.


FAQ

Frequently Asked Questions About dbx ==================================== General questions: (1) Gdb does <something>; how do I do it in dbx? (2) Dbx doesn't read my .dbxinit file anymore! Why not? (3) How do I enable command-line editing? (4) Why doesn't "alias" work? (5) Why don't `/' and `?' work anymore? (6) Why doesn't `0x1234/5X' work anymore? (7) Why does dbx keep saying "foo is not defined in the current scope"? What is a scope, anyway? (8) Why doesn't "set" work? (9) Dbx can't find my source files! (10) My program behaves differently when under dbx. (11) I put in a breakpoint and it's not reached. (12) Under 2.X I get one of dbx: corrupted _DYNAMIC structure (tag %d) dbx: _DYNAMIC structure longer than %d entries. Giving up dbx: _DYNAMIC structure does not contain DT_DEBUG entry warning: rtld<->dbx interface location is 0x0 followed by "process initialization failed". What does this mean? What is `rtld' anyway? (13) When I debug a corefile under 3.X I get messages like dbx: cannot get to dynamic linker<->dbx interface area in core file (_DYNAMIC array does not contain DT_DEBUG entry and although dbx says "core file header read successfully," when I say `where,' all I get are hexadecimal numbers. (14) Why is type of a C++ member sometimes missing in the output of `whatis'? (15) Why does Runtime Checking have this 8Mb limit? (16) How do I use dbx to locate floating-point exceptions? MT-related questions: (17) Where do I get the MT dbx? (18) What are the major MT features of dbx? (19) Can you limit your scope to a specific thread? (20) What are the major MT features of the GUI? (21) How does thread numbering work? (22) How does LWP numbering work? (22) How does LWP numbering work? (24) What happens when a thread hits a breakpoint? Do all threads stop, or only the thread that hit the breakpoint stops? (25) How does dbx know that an application is multi-threaded? (26) Can you use the Collector, RTC, Fix and Continue and Watchpoints with an MT application? (27) Why can't you use watchpoints with MT? (28) Why doesn't the Collector work with MT? (28) What pitfalls should I watch for? (29) Can I "force" a sleeping thread to run? (30) How can I tell which other thread a particular thread is waiting for? (i. e., via thr_join). Starting from the threads list in the Process/Thread Inspector, how can I determine which thread id came from which thr_create() call? (31) Starting from the threads list in the Process/Thread Inspector, how can I determine which thread id came from which start function? (32) When I attach to an existing multithreaded process, which thread becomes the active thread? (33) When the active thread does a thr_create, which thread becomes the active thread? (i. e., the one that did the thr_create() or the one that was thr_create'd?) (Another way to phrase this might be, is there a "follow_thread_mode" analogous to "follow_fork_mode"?) (34) When the active thread does a thr_exit, which thread (if any) becomes the active thread? (35) Where does dbx create any needed temporary files? -------------------------------------------------------------------------------- (1) Gdb does <something>; how do I do it in dbx? The following table list approximately equivalent dbx commands for some common gdb commands: GDB DBX for more information === === ==================== break <line> stop at <line> `help stop' break <func> stop in <func> `help stop' break *<addr> stopi at <addr> `help stopi' break ... if <expr> stop ... -if <expr> `help event specification' cond <n> stop ... -if <expr> `help event specification' tbreak stop ... -temp `help event specification' watch <expr> stop <expr> [slow] `help event specification' watch <var> stop modify &<var> [fast] `help event modify' catch <x> intercept <x> `help intercept' info break status `help status' info watch status `help status' clear clear `help clear' clear <fun> delete <n> `help delete' delete delete all `help delete' disable handler -disable all `help handler' disable <n> handler -disable <n> `help handler' enable handler -enable all `help handler' enable <n> handler -enable <n> `help handler' ignore <n> <cnt> handler -count <n> <cnt> `help handler' commands <n> when ... { <cmds>; } `help when' backtrace <n> where <n> `help where' frame <n> frame <n> `help frame' info reg <reg> print $<reg> `help registers' finish step up `help step' signal <num> cont sig <num> `help cont' jump <line> cont at <line> `help cont' set <var>=<expr> assign <var>=<expr> `help assign' x/<fmt> <addr> x <addr>/<fmt> `help examine' disassem <addr> dis <addr> `help dis' shell <cmd> sh <cmd> [if needed] `help sh' info func <regex> funcs <regexp> `help funcs' ptype <type> whatis -t <type> `help whatis' define <cmd> function <cmd> `help ksh syntax' handle <sig> stop sig <sig> `help event specification' info signals status; catch `help status', `help catch' attach <pid> debug - <pid> `help debug' (Solaris 2.x) attach <pid> debug <a.out> <pid> `help debug' (Solaris 1.x) file <file> [unnecessary] exec <file> debug <file> `help debug' core <file> debug <a.out> <file> `help debug' set editing on set -o emacs `help editing' set language <x> language <x> `help language' set prompt <x> PS1=<x> `help ksh PS1' set history size <x> HISTSIZE=<x> `help ksh HISTSIZE' set print object on dbxenv output_dynamic_type on `help c++ dynamic' show commands history `help history' dir <name> pathmap <name> `help pathmap' show dir pathmap `help pathmap' info line <n> listi <n> `help listi' info source file `help file' info sources files; modules `help files', `help modules' forw <regex> search <regex> `help search' rev <regex> bsearch <regex> `help bsearch' -------------------------------------------------------------------------------- (2) Dbx doesn't read my .dbxinit file anymore! Why not? If you have a .dbxrc file, then dbx will read it and ignore any .dbxinit file that may also be present. To get dbx to read both, add the following to your .dbxrc file: kalias alias=dalias source ~/.dbxinit kalias alias=kalias If you don't have a .dbxrc file, but do have a .dbxinit file, you should see a warning message: Using .dbxinit compatibility mode. See `help .dbxrc' for more information. In this case, dbx will read your .dbxinit file, even though it complains. This feature may disappear in a future release. -------------------------------------------------------------------------------- (3) How do I enable command-line editing? You can enable command-line editing in several ways. First, if $FCEDIT, $EDITOR, or $VISUAL is set, its value is checked. If the last component (i.e., after the last slash) contains the string "emacs", then emacs-mode is enabled. If it contains "vi", then vi-mode is enabled. If none of the three environment variables are set, or if the first one in the list that *is* set does not contain "emacs" or "vi", then command-line editing is disabled. You can enable emacs mode from the command line (or in your .dbxrc file) by typing set -o emacs Vi mode is similar: set -o vi To disable command-line editing, set +o emacs +o vi is sufficient. -------------------------------------------------------------------------------- (4) Why doesn't "alias" work? "alias" is now a pre-defined alias for either "dalias" or "kalias". See `help alias', `help dalias', `help kalias', and `help startup'. -------------------------------------------------------------------------------- (5) Why don't `/' and `?' work anymore? With the introduction of a KornShell-based parser, the `/' command had to be renamed because it cannot be distinguished from a UNIX pathname. For example, (dbx) /foo now means "execute the file named `foo' from the root directory." Similarly, `?' had to be renamed because it is now a shell metacharacter: (dbx) ?foo now means "expand the pattern (which matches all files in the current directory with a four-character filename having `foo' as the last three characters), then execute the resulting command." Use `search' instead of `/'. Use `bsearch' instead of `?'. See `help search' and `help bsearch'. Note: If you use these commands frequently, you may wish to create aliases for them: alias ff=search # find forward alias fb=bsearch # find backward -------------------------------------------------------------------------------- (6) Why doesn't `0x1234/5X' work anymore? For similar reasons to (5), the embedded slash command had to be renamed. Use `examine 0x1234/5X' instead (or the built-in alias `x'). See `help examine'. -------------------------------------------------------------------------------- (7) Why does dbx keep saying "foo is not defined in the current scope"? What is a scope, anyway? That message means that no symbol named `foo' is accessible from the current point of execution. See `help scope' for details. -------------------------------------------------------------------------------- (8) Why doesn't "set" work? "set" is now the KornShell "set" command; it is no longer an alias for "assign". See `help assign' and `help set'. -------------------------------------------------------------------------------- (9) Dbx can't find my source files! If your source files are not where they were when they were compiled, or if you compiled on a different machine than you are debugging on and the compile directory is not mounted as the same pathname, dbx will have trouble finding them. See `help pathmap' for a solution. -------------------------------------------------------------------------------- (10) My program behaves differently when under dbx. Dbx can typically affect the behaviour of a program in the following ways: The first available file descriptor at exec time might not be 3. This is a bug and we're trying to plug all the holes. So if you depend on pre-existing fd's or use them for indexing tables, etc., things might change. You might have forgotten to take out a -C or have left RTC on. Your dbx initialization scripts might have some environment variables set that you've forgotten about. The stack base starts at a different address when running under dbx. This also will be different based on your environment and contents of argv[]. This will force local variables to be allocated a bit differently and if they're not initialized, they will be getting different random numbers. This problem can be detected via Runtime Checking. See `help check'. The program does not initialize malloc()ed memory before use. This situation is similar to the previous one. The same suggestions apply. The program references an unitialized memory location via a bad pointer. This is similar to the previous two situations. The same suggestions apply. Dbx has to catch LWP creation and dlopen events. This might seriously affect the timings of things. Dbx also does context switching on signals, so if you have heavy use of signals which are timing sensitive, things might work differently. The program expects that mmap() will always return the same base address for mapped segments. Running under dbx perturbs the address space sufficiently to make it unlikely that mmap() will return the same address as when the program is run without dbx. To determine if this is a problem in your program, look at all uses of mmap() and ensure that the address returned is actually used by the program, rather than a hard-coded address. If the program is multi-threaded, it may contain data races or be otherwise dependent upon thread scheduling. Running under dbx perturbs thread scheduling somewhat and may cause the program to execute threads in a different order than it normally would. To detect such conditions, try `lock_lint'. See if running outside `GUI' (i.e. use `dbx'), or with `adb' or `truss' causes the same problems. Dbx should impose minimal perturbation when it attaches to a running process; give that a try. See `help debug'. -------------------------------------------------------------------------------- (11) I put in a breakpoint and it's not reached. Consider the following possibilities: If you've placed a bpt on a function, it might not be the function you think. Use `whereis <funcname>' to find out how many functions of a given name exist. Then use the exact syntax as presented by the output of `whereis' in your `stop' command. See the answer to (10). If the breakpoint is on a while loop you might run into trouble stemming from the fact that the compiler converts code of the form: while (<cond> ) <stmt> to if (<cond>) { again: <stmt> if <cond> goto again; } in which case putting a bpt on the `while' amounts to putting a bpt only on the outer `if'. This is because dbx cannot deal with source lines that map to two (or more) different addresses. -------------------------------------------------------------------------------- (12) Under 2.X I get one of dbx: corrupted _DYNAMIC structure (tag %d) dbx: _DYNAMIC structure longer than %d entries. Giving up dbx: _DYNAMIC structure does not contain DT_DEBUG entry warning: rtld<->dbx interface location is 0x0 followed by "process initialization failed". What does this mean? What is `rtld' anyway? `rtld' stands for `Run Time ld' also know as `ld.so,' otherwise known as the dynamic linker. A crucial data structure maintained by rtld is the `link map,' it is a list of all the shared libraries (.so's) that have been loaded into the process being debugged. The symbol named _DYNAMIC has pointers to the link map. Under 4.X _DYNAMIC is a structure as documented in <link.h>, it has a pointer to a structure `r_debug' used by dbx to get at the link map. Under 5.X _DYNAMIC is an array attribute/tag-value pairs. Now the _DYNAMIC structure is in user memory and as such is susceptible to corruption in which case dbx cannot get at the link map and is very much confused. For a detailed scenario of corruption and other causes of _DYNAMIC being bad see (13). The "process initialization failed" message and the ensuing uselesness of dbx is a bug which has been fixed in 3.X. See (13). -------------------------------------------------------------------------------- (13) When I debug a corefile under 3.X I get messages like dbx: cannot get to dynamic linker<->dbx interface area in core file (_DYNAMIC array does not contain DT_DEBUG entry and although dbx says "core file header read successfully," when I say `where,' all I get are hexadecimal numbers. First read (12) to learn what _DYNAMIC is. We took away the cryptic `rtld' and replaced it with `dynamic linker'. We also don't bail on this error so you can get _some_ debugging done. Why is the stack mostly hexadecimal numbers? Since dbx cannot get to the link map it cannot load the symbol tables for shared libraries, say libc.so. So if the coredump occured in libc, instead of seeing symbols like strcmp() in the stack trace you'll see a hex address. Why does _DYNAMIC get corrupted? We've experienced the following reasons: _DYNAMIC is in user space and as such susceptible to being overwritten by rogue pointers. This occurs particularly with corefiles as opposed to when you `run' your application because in the case `run' the DYNAMIC structure is accessed early on before the main application has had a chance to overwrite _DYNAMIC. On occasion, two processes can start dumping core into the same directory. The kernel doesn't interleave this properly so the resulting corefile will end up being an amalgamation of two process images. Its header and ELF structures might look fine, but the contents are nonsense. dbx has a hard time detecting such corefiles. This situation arises typically when a server/client pair is being debugged or dies. Corruption of _DYNAMIC is just one possible symptom of this scenario. Another reason this can happen is if the corefile is not exactly matched with the binary. In this case the symbol table will have addresses that have nothing to do with the reality of the corefile, so when dbx tries to look at _DYNAMIC it sees garbage. dbx _does_ try to check for the corefile and the executabels compatibility, but there is very little information in the corefile to help with this (even less than on 4.x) so dbx might think that the core and the program match when they in fact do not. -------------------------------------------------------------------------------- (14) Why is type of a C++ member sometimes missing in the output of `whatis'? In the following whatis command, the type of member `stackcount' is missing: (dbx) whatis stack class stack { ... static stackcount; /* Never defined or allocated */ ... }; When a class member is not defined or allocated, dbx cannot determine its type. There is no type to print. -------------------------------------------------------------------------------- (15) Why does Runtime Checking have this 8Mb limit? Only access checking has this limit. Leaks checking is not affected by this. To do access checking dbx/RTC replaces each load and store instruction with a branch instruction that branches to a patch area. This branch instruction has an 8Mb range. This means that if the debugged program has used up all the address space within 8Mb of the particular load/store instruction being replaced, there is no place to put the patch area. If RTC can't intercept ALL loads and stores to memory it cannot provide accurate information and so disables access checking completely. Dbx internally applies some strategies when it runs into this limitation and continues if it can rectify this problem. In some cases dbx cannot proceed; when this happens it will turn off access checking after printing an error message (see `help rtc 8M' for possible workarounds). -------------------------------------------------------------------------------- (16) How do I use dbx to locate floating-point exceptions? You need to do two things: In dbx say "catch FPE". This will stop the process whenever an FP exception happens. But this isn't enough. The ieee software typically sets all errors to be silent (not raising signals). You'll have to add the following to your FORTRAN application integer ieeer, ieee_handler, myhandler ieeer = ieee_handler('set', 'all', myhandler) ... integer function myhandler(sig, code, context) integer sig, code(5) call abort() end This will cause _all_ ieee exceptions to generate a SIGFPE as appropriate, which might be a bit too much. You can further tailor which exceptions you see by tweaking the parameters of ieee_handler() or by using an alternative to the dbx catch command: stop sig FPE which acts just like "catch FPE", or stop sig FPE <subcode> for finer control. <subcode> can be one of FPE_INTDIV 1 # integer divide by zero FPE_INTOVF 2 # integer overflow FPE_FLTDIV 3 # floating-point divide by zero FPE_FLTOVF 4 # floating-point overflow FPE_FLTUND 5 # floating-point underflow FPE_FLTRES 6 # floating-point inexact result FPE_FLTINV 7 # invalid floating-point operation FPE_FLTSUB 8 # subscript out of range which you can also see by saying `help signals'. Note that "stop" and "catch" are independent and that if you use "stop FPE" you should also "ignore FPE". See also the "Debugging" appendix of your Fortran documentation. -------------------------------------------------------------------------------- (17) Where do I get the MT dbx? You don't need to get a specific MT dbx. MT features are an inherent part of the standard dbx. With the 4.0 dbx release you do not need to have a separate license to use the MT functionality. -------------------------------------------------------------------------------- (18) What are the major MT features of dbx? The `threads' command will give a list of all known threads, with their current state, base functions, current functions etc. You can examine stack traces of each thread. You can resume (`cont') a specific or all threads. You can `step' or `next' a specific thread. The `thread' command helps navigating between threads. -------------------------------------------------------------------------------- (19) Can you limit your scope to a specific thread? `dbx' maintains a cursor to the "current" or "active" thread. It is manipulable by the `thread' command. About the only commands which uses the current thread as the default thread are `where' and `thread -info'. -------------------------------------------------------------------------------- (20) What are the major MT features of the GUI? A GUI interface to the `threads' command which shows an up-to-date list of threads in the "Process/Thread Inspector". The Process/Thread Inspector is linked to the "Stack Inspector" So you can quickly and efficiently look at all threads' stacks. -------------------------------------------------------------------------------- (21) How does thread numbering work? dbx knows the id of each thread (the type thread_t) as returned by `thr_create()'. The syntax is `t@<number>'. -------------------------------------------------------------------------------- (22) How does LWP numbering work? dbx knows the id of each LWP (the type lwpid_t) as presented by the /proc (man procfs(4)) interface. The syntax is `l@<number>'. -------------------------------------------------------------------------------- (23) Can you have a breakpoint on a specific thread? Yes, by filtering a regular breakpoint as follows: stop in foo -thread t@4 Where the `t@4' refers to the thread with id 4. -------------------------------------------------------------------------------- (24) What happens when a thread hits a breakpoint? Do all threads stop, or only the thread that hit the breakpoint stops? All threads stop. This is knows as "sympathetic stop", or "stop the world". from the point of view of /proc and LWPs this is "synchronous" debugging. -------------------------------------------------------------------------------- (25) How does dbx know that an application is multi-threaded? If an application is linked with -lthread, dbx assumes it is multi-threaded. -------------------------------------------------------------------------------- (26) Can you use the Collector, RTC, Fix and Continue and Watchpoints with an MT application? Collector works with MT applications now. RTC works with MT applications on Solaris 2.4 and above (on Solaris 2.4 a libthread patch is needed; see `help rtc mt' for details). F&C works with MT applications. Watchpoints do not support MT applications by default (see the next question on how to override this). -------------------------------------------------------------------------------- (27) Why can't you use watchpoints with MT? The implementation of watchpoints does not depend on the OS and has the potential of too easily getting the MT application into a deadlock or other obscure problems. Once the operating system provides watchpointing facility, watchpointing should work for MT applications as well. The dbx env setting "mt_watchpoints" can be used to override this default, but be careful of deadlock. -------------------------------------------------------------------------------- (28) What pitfalls should I watch for with MT? It is very easy to get your program to deadlock by resuming only a specific thread while other threads are still and hold a resource that the resumed thread might need. libthread data structures are in user space and might get corrupted by bugs involving rogue pointers. In such cases one suggestion is to work at the LWP level with commands like `lwps' and `lwp' which are analogous to their thread equivalents. -------------------------------------------------------------------------------- (29) Can I "force" a sleeping thread to run? You cannot. In future version you might be able to, but in general when debugging MT applications it is recommended that you take a "stand back and watch" approach rather than trying to force your will on the programs natural execution flow. -------------------------------------------------------------------------------- (30) How can I tell which other thread a particular thread is waiting for? (i. e., via thr_join). Starting from the threads list in the Process/Thread Inspector, how can I determine which thread id came from which thr_create() call? You currently cannot. We're waiting for a more sophisticated interface to help dbx query the state of threads. -------------------------------------------------------------------------------- (31) Starting from the threads list in the Process/Thread Inspector, how can I determine which thread id came from which start function? The "base function" as it is known, is printed in the thread listing. -------------------------------------------------------------------------------- (32) When I attach to an existing multithreaded process, which thread becomes the active thread? It's non-deterministic. -------------------------------------------------------------------------------- (33) When the active thread does a thr_create, which thread becomes the active thread? (i. e., the one that did the thr_create() or the one that was thr_create'd?) (Another way to phrase this might be, is there a "follow_thread_mode" analogous to "follow_fork_mode"?) The current threads stays with the "creating thread". In the follow_fork analogy, it would be `parent'. Note that the Sun MT model doesn't have true `fork' semantics for threads. There is no thread tree, and no parent-child relationships like with processes. thr_join() is only a simplified veneer. -------------------------------------------------------------------------------- (34) When the active thread does a thr_exit, which thread (if any) becomes the active thread? Dbx makes a dummy "dead" thread the active thread. This thread is represented as `t@X'. -------------------------------------------------------------------------------- (35) Where does dbx create any needed temporary files? Dbx will use the directory /tmp (or the value of the environment variable TMPDIR if it is set) for all it's temporary files. All the dbx temporary files with start with "dbx." and be unique to that dbx session. All dbx temporary files are removed when dbx terminates.


MT

(Solaris 2.x) dbx has several new commands to deal with multithreaded programs on Solaris 2.3 and later. See the following help topics for more information: threads thread lwps lwp In addition, many commands take thread or LWP qualifiers. See the following help topics for more information: cont step events `event specification' mtfeatures where Or use `help -k <keyword>' to find help topics that mention the word <keyword>.


ObjC

Dynamic Types ------------- In Objective C an object pointer has two types; its static type, which is defined in the source code, and its dynamic type, which is known at run-time. dbx can provide information about the dynamic type of an object when using the `print', `display', and `whatis' commands specifying the `-d' option or by setting the dbxenv `output_dynamic_type' to `on'. If the `+d' option is used, the commands use the static type. When debugging Objective C programs, put `dbxenv ouput_dynamic_type on' in your ~/.dbxrc file . Finding Methods and Using Method Names in Non-expression Commands ----------------------------------------------------------------- `stop in', `func', `whatis, `list', `edit' are non-expression commands. Use the `funcs' command (with a regular expression) to find methods and functions that dbx knows about and to print them in a format dbx accepts. See `help funcs' for more details. If the process is active, dbx uses the run-time system to lookup a method, otherwise dbx uses static information (stabs). Setting Breakpoints ------------------- The following variations of the `stop' command are accepted by dbx for setting breakpoints in ObjC methods: stop in -[Test ival:second:] stop in +[Test alloc] stop in [Test ival:second:] stop in [obj ival:second:] // through an object (only if active process) stop in ``ival:second: // searches all classes for ival:second: stop in ival:second: // only if dbxenv scope_look_aside is `on' stop inmethod ival:second: // stops in all methods with that name If the process is not active, use the following syntax for category methods: stop in -[Test(Cat1) catmethod:second:] Calling ObjC Methods -------------------- All ObjC instance methods have to be called through an object. Some valid variations of calling ObjC methods: call [obj ival: 30] // calling instance method with parameter call [self ival: 30] // use self if stopped inside a class call [Test alloc] // calling class method Recover from a run-time system crash ------------------------------------ dbx calls the ObjC run-time system to lookup methods and, if `output_dynamic_type' is on, to find the dynamic type of an object, but that can in some cases cause a crash of the run-time system. dbx can recover using the `pop' command. Use `where' then `pop' to unwind frames from the stack. See also `help c++' and `help scope'.


PATH

By default, dbx searches your $PATH for commands. To disable $PATH search, type `set +o path'. See `help ksh options' and `help ksh PATH'.


[

The `[ <expr> ]' command is an alternative syntax for `test <expr>'. Use `help test' for more information.


_cb_aoutchange

_cb_aoutchange <old_a.out_name> <new_a.out_name> This ksh function is invoked by dbx whenever the program being debugged changes--the full path name is different. This is a good place to set a.out-specific breakpoints. For example: _cb_aoutchange() { case "$2" in *producer) stop in make_some_more ;; *consumer) stop in get_another_one ;; esac }


_cb_fix_comp

_cb_fix_comp <compilation arguments> This ksh function, if defined, is invoked by dbx instead of calling the compiler directly during a `fix'. This is a good place to customize the compilation line by adding or changing options, modifying paths, etc. Use with caution. For example: _cb_fix_comp() { zzzzzzzz echo $* eval $* } This just echoes and executes the compilation line without modifications, whereas: _cb_fix_comp() { eval "$(echo $* | sed -e 's! -g0 ! -g !')" } replaces '-g0' with '-g' to turn off inlining and execute the compiler. The arguments of this function are from the original, unmodified compilation line, plus some options added internally for use by dbx. See also `help _cb_fix_link'.


_cb_fix_link

_cb_fix_link <linker arguments> This ksh function, if defined, is invoked by dbx instead of calling the linker directly during a `fix'. This is a good place to customize the link line by adding or changing options, modifying paths, etc. Use with caution. This link creates a shared object which is dlopen'd into the target process. It does *not* modify the a.out. For example: _cb_fix_link() { echo $* eval $* } echoes and executes the link line. See also `help _cb_fix_comp'.


_cb_prompt

_cb_prompt This ksh function is invoked by dbx immediately before it prints the top level prompt (PS1). This is a good place to set PS1 so that it reflects the current state of the process. _cb_prompt receives no arguments.


adb

adb # enter adb mode adb <cmd> # execute one adb command When in adb mode, variable ($foo) substitution is disabled. Command-line editing and history are supported in adb mode. Quick Start Summary: $c # show the call stack $C # show a verbose call stack <sym>:b # set breakpoint at symbol :d # delete all breakpoints at $pc :r # run; begin executing from the beginning :c # continue execution :s # single step one instruction :e # single step, do not stop in called functions $r # display registers $b # list breakpoints <sym>?X # display value of variable as hex word (4 bytes) $q # quit (exit adb mode; does not exit dbx) @<dbxcmd> # execute a dbx command, return to adb mode Usage: <objfile> refers to to the executable image on disk; <corefile> refers to the live process or core file, as appropriate. The symbol `.' represents the current location. Commands consist of three optional parts and are separated by semicolons or newlines: [ <address> ] [ , <count> ] [ <command> ] [ ; ] <address> and <count> are expressions (see below). The default <address> is `.'; the default <count> is 1. In the following, an asterisk (*) at the left margin marks significant differences between this command and the `adb' program. Numbers: The current input radix (see `$d') determines the interpretation of numbers which start with a digit from 0 through 9. * Unlike the adb program, this command does not accept hex numbers which * start with a letter; use `0x...'. Regardless of the current input radix, numbers which start with `0o' or `0O' are taken as octal, `0t' or `0T' as decimal, and `0x' or `0X' as hexadecimal. Expressions: . the current location + `.' incremented by the current increment ^ `.' decremented by the current increment & the last address typed n an integer constant n.n a floating point number 'c' ASCII constant (one to four characters) <name the value of <name>, which is either a variable name or a register name sym a symbol (exp) parentheses may be used for grouping *exp the contents of <exp> in <corefile> %exp the contents of <exp> in <objfile> -exp integer negation ~exp bitwise complement #exp logical negation e+e integer addition e-e integer subtraction e*e integer multiplication e%e integer division e&e bitwise `and' e|e bitwise `or' e1#e2 <e1> rounded up to the next multiple of <e2> Commands: ? print locations starting at <addr> in <objfile> / print locations startind at <addr> in <corefile> = print the value of <addr> : manage a subprocess $ status, miscellaneous actions > assign a value to a variable or register <RET> repeat the previous command with <count> of 1 and increment `.' * @ execute a dbx-style command Modifiers of ?, /, and =: The following format modifiers apply to the commands ?, /, and =. To specify a format, follow the command with an optional repeat count, and the desired format letter or letters: {?,/,=} [ [ r ] f ... ] ] where <r> is a repeat count, and <f> is one of the format letters listed below: o (`.' increment: 2) Print 2 bytes in octal O (4) Print 4 bytes in octal q (2) Print in signed octal Q (4) Print long signed octal d (2) Print in decimal D (4) Print long decimal x (2) Print 2 bytes in hexadecimal X (4) Print 4 bytes in hexadecimal u (2) Print as an unsigned decimal number U (4) Print long unsigned decimal f (4) Print a single-precision floating-point number F (8) Print a double-precision floating-point number b (1) Print the addressed byte in octal c (1) Print the addressed character C (1) Print the addressed character using ^ escape convention s (n) Print the addressed string S (n) Print a string using the ^ escape convention. Y (4) Print 4 bytes in date format i (4 on SPARC; n on x86) Print as machine instructions a (0) Print the value of `.' in symbolic form p (4) Print the addressed value in symbolic form t (0) Tab to the next appropriate TAB stop r (0) Print a SPACE n (0) Print a NEWLINE "..." (0) Print the enclosed string ^ (0) Decrement `.' + (0) Increment `.' - (0) Decrement `.' by 1 : Modifiers b Set breakpoint b <cmds> Set breakpoint, execute commands when reached r Run <objfile> as a subprocess with previous arguments d Delete breakpoint at <addr> z Delete all breakpoints * D Delete all breakpoints c Continue the subprocess s Single-step the subprocess * e Single-step, but do not stop in called functions i Add the signal specified by <addr> to the list of signals passed directly to the subprocess (`ignore') * I Add all signals to the list of signals to be passed directly to the process (`ignore all') t Remove the signal specified by <addr> from the list implicitly passed to the subprocess (`catch') * T Remove all signals from the list from the list implicitly passed to the subprocess (`catch all') k Terminate (kill) the current subprocess, if any A Attach to an existing process id. (For example, 0t1234:A would attach to decimal process number 1234.) R Release a previously attached process $ Modifiers <filename Read commands from the file <filename> <<filename Similar to <, but can be used in a file of commands without closing the file >filename Append output to filename, which is created if it does not exist. ? Print process ID, the signal which stopped the subprocess, and the registers. r Print the names and contents of the general registers, and the instruction addressed by <pc. b Print all breakpoints and their associated counts and commands * c C stack backtrace, no arguments, file names, or line numbers * C Same as $c, but in addition it displays the arguments, file name, and line number for each frame d Set the default radix to address and report the new value. Note: <addr> is interpreted in the current radix. Thus `10$d' never changes the default radix. o All integers input are regarded as octal * q Exit from adb mode (does not quit from dbx) v Print all non-zero user variables in hex * V Print the values of all (user) variables in hex * m Print the address map (list of loadobjects with low and high text addresses) i Show which signals are passed to the subprocess with the minimum of interference * I List all signals and indicate which will be passed implicitly to the subprocess (flag == 1)


alias

`alias' is an alias for either `dalias' or `kalias'. Type `alias alias' to find out which, then see either `help kalias' or `help dalias' as appropriate. The default is `kalias' unless dbx finds a .dbxinit file and no .dbxrc file, in which case the default is `dalias'.


array-slicing

dbx supports array slicing in the `print' and `display' commands for C, C++, and Fortran. The array-slicing syntax for C and C++: print <arr-exp>[<first-exp>..<last-exp>:<stride-exp>] where: <arr-exp> is an expression that evaluates to an array or pointer type, <first-exp> and <last-exp> are the first and last elements to be printed, <stride-exp> is the stride. <first-exp>, <last-exp>, and <stride-exp> are (optional) expressions that should evaluate to integers. <first-exp> and <stride-exp> default to 0 and 1, respectively. <last-exp> is optional for array types and defaults to its upper bound. Examples: (dbx) print arr[2..4] arr[2..4] = [2] = 2 [3] = 3 [4] = 4 (dbx) print arr[..2] arr[0..2] = [0] = 0 [1] = 1 [2] = 2 (dbx) print arr[2..6:2] arr[2..8:2] = [2] = 2 [4] = 4 [6] = 6 The array-slicing syntax for Fortran: print <arr-exp>(<first-exp>:<last-exp>:<stride-exp>) where: <arr-exp> is an expression that should evaluate to an array type, <first-exp> and <last-exp> are first and last elements to be printed, <stride-exp> is the stride. <first-exp>, <last-exp>, and <stride-exp> are (optional) expressions that should evaluate to integers. <first-exp> and <last-exp> default to the lower and upper bound, respectively. <stride-exp> defaults to 1. Examples: (dbx) print arr(2:6) arr(2:6) = (2) 2 (3) 3 (4) 4 (5) 5 (6) 6 (dbx) print arr(2:6:2) arr(2:6:2) = (2) 2 (4) 4 (6) 6


assign

assign <var> = <exp> # Assign the value of the <exp> to <var>


bg

bg # Put the current job into the background bg %+ # Put the current job into the background bg %- # Put the previous job into the background bg %<n> # Put job number <n> into the background bg %<str> # Put the job which begins with <str> into the background bg %?<str> # Put the job which contains <str> into the background The `%' is optional in all cases.


bind

bind # Display the current emacs editing key bindings bind <key>=<def> # Bind <key> to definition <def> bind <key> # Display the current definition for <key> bind <key>= # Remove binding of <key> bind -m <key>=<def> # Define <key> to be a macro with definition <def> bind -m # Same as `bind'


break

break # Break out of enclosing loop (`while', `until', or `for'). break <n> # Break out of <n> enclosing loops.


bsearch

bsearch <string> # Search backward for <string> in the current file bsearch # Repeat search, using the last search string


builtin

builtin <cmd> [<args>] # Execute the <cmd>, suppressing the normal search for a function or alias named <cmd>. If <cmd> is not a builtin, it displays an error message.


button

button <seltype> <cmd> # Define a software button where selection type, <seltype>, is: ignore # Ignore the selection literal # Take the selection literally lineno # Lineno from the source window This command is silently ignored unless dbx is running under the control of WorkShop. See also `help unbutton'.


c++

Use the command `help c++ <subtopic>' to get more help on one of the subtopics. whatis # finding out about class definitions printing # printing or displaying inherited data members dynamic # finding out dynamic information about an object pointer vfuncs # information about debugging virtual functions rtti # using run-time type information inclass # setting breakpoints on all member functions of a class inmember # setting breakpoints on all overloaded member functions inobject # setting breakpoints on all member functions of a class infunction # setting breakpoints on all overloaded non-member functions overloaded # dealing with overloaded functions/data members Or use `help -k <keyword>' to find help topics that mention the word <keyword>.


c++ dynamic

In C++, an object pointer has two types: its static type (what is defined in the source code), and its dynamic type (what an object was before any casts were made to it). dbx can sometimes provide you with the information about the dynamic type of an object when using the `print', `display', and `whatis' command with the `-d' option or by setting the dbxenv `ouput_dynamic_type' to `on'. In general, when an object has a virtual function table ("vtable") in it, dbx can use the information in the vtable to correctly figure out what an object's type is. Using the `-d' flag (or setting the dbxenv `output_dynamic_type' to `on') when there is no process running generates a "program is not active" error message because it is not possible to access dynamic information when there is no process. An "illegal cast on class pointers" error message is generated if you try to find a dynamic type through a virtual inheritance (casting from a virtual baseclass to a derived class is not legal in C++).


c++ inclass

The `inclass' event specifier allows you to set a breakpoint at all member functions defined for a specified class. It can be used with the `stop', `when', and `trace' commands. See `help event specification'.


c++ infunction

The `infunction' event specifier allows you to set a breakpoint at all non-member functions with a specified name that are defined. It can be used with the `stop' and `when' commands. See `help event specification'.


c++ inmember

The `inmember' event specifier allows you to set a breakpoint at all member functions with a specified name that are defined in any class. It can be used with the `stop', `when', and `trace' commands. See `help event specification'.


c++ inobject

The `inobject' event specifier allows you to set a breakpoint at all non-static member functions defined for a specified c++ object (pointer to a C++ class/struct/union) and stop only if called via the object. It can be used with the `stop', `trace' and `when' commands. If the dbxenv variable `output_dynamic_type' is on, dbx will use the dynamic type of the object. See `help c++ dynamic' and `help event specification'.


c++ overloaded

dbx should be able to determine which variable or function you are referring to except when: *You reference an overloaded function by name only *You reference a function or variable with a leading `` Consider the following example: int foo(double); int foo(int); int bar(); class x { int bar(); }; When you stopped at a non-member function, you can say: stop in foo(int) or stop in foo(1) to set a breakpoint at the global foo(int). To set a breakpoint at the member function you can use the command: stop in x::bar() If you just say: stop in foo dbx will not know if you mean the global function foo(int) or the global function foo(double) and be forced to give you an overloaded menu for clarification. Lastly, if you say: stop in ``bar dbx will not know if you mean the global function bar() or the member function bar() and give you an overloaded menu.


c++ printing

When you give `print' or `display' a `-r' (recursive) option, the GUI shows you all the data members directly defined by a class as well as those inherited from base classes. These three commands also take a `-d' or `+d' option that toggles the default behavior of the dbxenv `output_derived_type'. See `help c++ dynamic' for more information.


c++ rtti

dbx supports the C++ `dynamic_cast' and `typeid' operators. When evaluating expressions with these two operators, dbx makes calls to certain rtti functions made available by the compiler. If the source doesn't explicitly use the operators, those functions may not have been generated by the compiler, and dbx will fail to evaluate the expression.


c++ vfuncs

Virtual functions can be called just like any other function by using the `print' or `call' command, or any other command that executes a function call. NOTE: This support is only available with Sun C++ compilers 3.0 or greater.


c++ whatis

The `whatis' command, when run on a C++ class or structure, provides you with a list of all the defined member functions (undefined member functions are not listed), the static data members, the class friends, and the data members that are defined explicitly within that class. Specifying the `-r' (recursive) option adds information from the inherited classes. The `-d' flag, when used with the `-e' flag, uses the dynamic type of the expression. See `help c++ dynamic' for more information.


call

call <proc>([params]) # Call the procedure


callbacks

A callback is a ksh function that is automatically invoked by dbx at certain points in the execution of the target. You can define your own version of any of these functions to perform desired tasks as necessary. The default versions do nothing. Currently, the following callbacks are supported: _cb_aoutchange _cb_prompt _cb_fix_comp _cb_fix_link See the help on the individual function name for details.


cancel

cancel # Cancel the current signal. Primarily used # within the body of a WHEN


catch

catch # Print a list of the caught signals catch <num> <num>... # Catch signal(s) numbered <num> catch <sig> <sig>... # Catch signal(s) named by <sig> # SIGKILL cannot be caught or ignored. # See also `help ignore'.


cd

cd # Change directory to $HOME cd <dir> # Change directory to <dir>. If <dir> does not contain a slash, search $CDPATH. If <dir> contains a slash, use it as-is. In either case, if <dir> begins with a tilde (`~'), replace `~/' with $HOME, or `~<name>' with the HOME directory of user <name>. cd <old> <new> # Change directory to <newdir>, where <newdir> is derived by replacing the string <old> in the current directory name with <new>. cd - # Change directory to $OLDPWD


changes

The major new features of this release relative to 3.2 are: o The Collector now supports MT applications (see `help collectormt') o Runtime checking (RTC) is supported with fork/exec/attach (see `help rtc attach' for details) o RTC has an API for allocators (see `help rtc api') o New command `regs' to print current value of registers (see `help regs') o New command `showblock' to give details about heap block (see `help showblock') o Enhanced `pathmap' command (see `help pathmap') o New dbxenv variable 'language_mode' (see `help dbxenv' under `language_mode') o New dbxenv variable 'output_inherited_members' (ee `help dbxenv' under `output_inherited_members') o Two new dbx read-only variables: $helpfile and $helpfile_html (see `help help') o New -v (verbose) flag to the `module' and `modules' commands (see `help module' and `help modules') o New +r flag to print and display commands (see `help print') o Default value of dbxenv variable `scope_look_aside' has been changed to on (see `help dbxenv' under scope_look_aside and `help scope') o New `inobject' event for support of `stop inobject <c++_obj_exp>' (see `help c++ inobject' and `help event specification') o `inclass' event now supports template classes (see `help c++ inclass' and `help event specification') o `stop at <lineno>' now supports C++ template definitions as well as C++ inlined functions defined in header files (see `help event specification' under `at' event) o Support for new C++ operators: `const_cast', `dynamic_cast', `reinterpret_cast', and `static_cast' o Support for new C++ `typeid' operator o An HTML version of the help file is available (see `help help') See also `help changes32'


changes301

The major new features of 3.0.1 relative to 2.0.1 are: (1) New KornShell-like command interpreter (see `help ksh' for details) (2) Support for multi-threaded programs (see `help MT') (Solaris 2.x) (3) Better C++ support (see `help c++') (4) Language expressions using $[] (see `help ksh expressions') (5) More powerful event mechanism (see `help events') (6) Fast data watchpoints (see `help event modify') (Solaris 2.x) (7) Automatic following of exec() and fork() (see `help follow-fork' and `help debug clone') (Solaris 2.x) (8) Fix and Continue (see `help fix') (9) Runtime Checking (see `help rtc', `help check', and `help showleaks') The following incompatibilities exist between this version and release 2.0.1: (1) The `address/format' command is now `x address/format' (2) The `address=format' command is now `x address=format' (3) The `/pattern' command is now `search pattern' (4) The `?pattern' command is now `bsearch pattern' (5) The `set' command is now the KornShell `set' command; use `assign' (6) The syntax of the `modules' command has changed (see `help module' and `help modules') (7) The corefile is used only if explicitly requested (8) Redirected output from `status' is no longer usable as input (see `help status')


changes31

The major new features of 3.1 (SparcWorks 3.0.2) relative to 3.0.1 are o Runtime Checking (RTC) now supports multi-threaded applications. See `help rtc mt'. (Solaris 2.x) o `adb' mode (see `help adb' for details) o Output format control (see `help dbxenv' under `output_base') o Array-slicing for C and C++ (see `help array-slicing') o Support for Fortran intrinsic functions. o `print' flags for $[] (see `help ksh expressions') o Printf-like output format control (see `help format') o Support for user-supplied pretty printing functions (see `help prettyprint') o The `runargs' command (see `help runargs') See also `help changes301'.


changes32

The major new features of 3.2 (SPARCWorks 3.1) relative to 3.1 are: o Objective C support (see `help ObjC') o Fortran 90 support (see `help fortran') o Runtime checking (RTC) gives information about memory usage (see `help check' and `help showmemuse') o `whereis -a' shows symbolic name of address (see `help whereis') o Support for Pascal's `with' statement o SPARC V8+ support (see `help dbxenv' and `help registers') o Better support for stripped binaries o One-line descriptions of all commands (see `help commands') o dbx outputs and accepts the suffixes `U', `L', and `LL' to denote unsigned, long, and long long quantities. See also `help changes31'.


check

check Print current status of Runtime checking (RTC). check -access Turn on access checking. RTC reports the following errors: 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 The default behavior is to stop the process after detecting each access error, which can be changed using the `rtc_auto_continue' dbxenv variable. When set to `on', access errors are logged to a file (the file name is controlled by the `rtc_error_log_file_name' dbxenv variable). See `help dbxenv'. By default each unique access error is only reported the first time it happens. Change this behavior using the `rtc_auto_suppress' dbxenv variable (the default setting of this variable is `on'). See `help dbxenv'. check -leaks [-frames <n>] [-match <m>] Turn on leak checking. RTC reports the following errors: 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 With leak checking turned on, you get an automatic leak report when the program exits. All leaks including possible leaks are reported at that time. By default, a non-verbose report is generated (controlled by the dbxenv `rtc_mel_at_exit'). However, you can ask for a leak report at any time (see `help showleaks'). -frames <n> implies that up to <n> distinct stack frames are displayed when reporting leaks. -match <m> is used for combining leaks; if the call stack at the time of allocation for two or more leaks matches <m> frames, then these leaks are reported in a single combined leak report. The default value of <n> is 8 or the value of <m> (whichever is larger). Maximum value of <n> is 16. The default value of <m> is 2. check -memuse [-frames <n>] [-match <m>] Turn on memory use (memuse) checking. check -memuse also implies check -leaks. In addition to a leak report at program exit,you also get a blocks in use (biu) report. By default a non-verbose blocks in use report is generated (controlled by the dbxenv `rtc_biu_at_exit') At any time during program execution you can see where the memory in your program has been allocated (see `help showmemuse'). -frames <n> implies that upto <n> distinct stack frames will be displayed while reporting memuse/leaks. -match <m> is used for combining these reports; if the call stack at the time of allocation for two or more leaks matches <m> frames, then these are reported in a single combined memuse/leak report. The default value of <n> is 8 or the value of <m> (whichever is larger). Maximum value of <n> is 16. The default value of <m> is 2. See check -leaks as well. check -all [-frames <n>] [-match <m>] Equivalent to `check -access; check -memuse [-frames <n>] [-match <m>]' The value of rtc_biu_at_exit dbxenv variable is not changed with check -all. So by default no memory use report is generated at exit. See `help dbxenv' for the description of the rtc_biu_at_exit variable. check [<funcs>] [<files>] [<loadobjects>] Equivalent to `check -all; suppress all; unsuppress all in <funcs> <files> <loadobjects>;' You can use this to focus RTC on places of interest. NOTE on errors suppressed by default: To detect all errors, RTC does not require the program be compiled -g. However, symbolic (-g) information is sometimes needed to guarantee the correctness of certain errors (mostly read from uninitialized memory). For this reason certain errors (`rui' for a.out and `rui + aib + air' for shared libraries) are suppressed if no symbolic information is available. This behavior can be changed by using `suppress' and `unsuppress'. See `help uncheck' for information to turn off checking. See `help suppress' for information on suppressing of errors See `help rtc' for an introduction to RTC. See also `help showleaks' and `help showmemuse'.


clear

clear # Clear all breakpoints at the current stopping point clear <line> # Clear all breakpoints at <line> clear <filename>:<line># Clear all breakpoints at <line> in <filename>


collector

collector support is available only on Solaris 2.x. collector <command list> # Specify one or more of the collector commands profile <options> # Specify profiling settings sample <options> # Specify sampling settings show <options> # Show current collector settings store <options> # Experiment file control and settings working_set <options> # Specify working set settings close # Close current experiment status # Inquire status about current experiment quit # Stop collecting performance data To collect performance data, choose one of the following: The dbx collector commands To start collecting data, type either "collector sample mode continuous" or "collector sample mode manual". This will turn on data collection until you type "collector sample mode off" or "quit". Type `collector show' to see all the collector settings at any time. Also see `help collectormt'.


collector close

collector close # Close current experiment


collector profile

collector profile <options> # Specify one or more of the profile options mode <stack|pc_only|off> # Specify profile data collection mode timer <milliseconds> # Specify profile timer period


collector quit

collector quit # Stop collecting performance data


collector sample

collector sample <options> # Specify one or more of the sample options mode <continuous|manual|off> # Specify data collection mode period <seconds> # Specify data collection period


collector show

collector show <options> # Show settings of one or more categories <no options> # Show all settings all # Show all settings profile # Show profile settings sample # Show sample settings store # Show store settings working_set # Show working_set settings


collector status

collector status # Inquire status about current experiment


collector store

collector store <options> # Specify one or more of the store options directory <string> # Specify directory where experiment is stored filename <string> # Specify experiment file name


collector working_set

collector working_set <options> # Specify one or more of the working set options mode <on|off> # Specify data collection mode


collectormt

Data collection for MT applications is supported. There are some restrictions and limitation about MT collection: o You cannot collect information about the code which executes in the init sections of shared libraries (a.out is ok). o For 'profiling', there are some restrictions: - It is only supported on Solaris 2.5 or above - You cannot start profiling in the middle of the run. You have to start it in the beginning (however, you can disable it in the middle of run and then enable it again). - You cannot change the profile timer in the middle of the run For non-MT applications, you could get profiling for a selected region of the code by turing on profiling in the middle of the run (and then turning it off at a convenient location). Given the restriction that you cannot turn on profiling in the middle of the run, you can get profiling for a selected region of code by doing the following: collector sample mode <manual|continuous> collector profile mode <pc_only|stack> #do this now because we cannot do it #once the program starts running stop in main run collector profile mode off #we dont want profiling for the whole app .... #later when you reach the beginning of the interesting point collector profile mode <pc_only|stack> #this is OK now because it was already #setup before the program run. .... #later when you reach the end of the interesting point collector profile mode off


commands

commands # List all built-in commands with one-line descriptions


cont

cont # Continue execution. In an MT process all threads are # resumed. Use ^C to stop executing the program. cont ... -sig <signo> # Continue execution with signal <signo> cont ... <id> # The <id> specifies which thread or LWP to continue. cont at <line> <id> # Continue execution at line <line>. <id> is required. cont ... -follow parent|child|both # If $DBX_follow_fork_mode is set to 'ask', and # you've chosen 'stop', use this option to choose # which process to follow. 'both' is only applicable # under WorkShop. See also 'help dbxenv'. See `help continue' for dbx command language loop control.


continue

continue # Continue executing commands with the next iteration of the nearest enclosing loop (`while', `until', or `for') continue <n> # Continue execution with the next iteration of the <n>th enclosing loop. See `help cont' for process control.


dalias

dalias # (Dbx alias) List all currently defined aliases dalias <name> # List the definition, if any, of alias <name> dalias <name> <def> # Define <name> to be an alias for <def>. <def> may contain white space. A semicolon or newline terminates the definition. See also `help alias' and `help kalias'.


dbx

# See `help invocation'.


dbxdebug

dbxdebug # Displays various internal data structures. Not available unless `debugging.so' has been imported.


dbxdir

This predefined read-only variable has the full pathname of the directory which contains the dbx executable.


dbxenv

dbxenv # Display the dbx customization variables dbxenv aout_cache_size <num> # Size of a.out loadobject cache; set this # to <n> when debugging <n> programs serially # from a single dbx. Setting to zero still # allows caching of shared objects. Also see # entry for `locache_enable'. Default: 1 dbxenv array_bounds_check <on | off> # (f77 and f90)If on, dbx checks the array bounds. # Default: on dbxenv cfront_demangling <on | off> # Governs demangling of Cfront (SC 2.0 and # SC 2.0.1) names while loading a program. If # debugging programs compiled with Cfront # or programs linked with Cfront compiled # libraries, it is not necessary to set this # parameter to `on' or start dbx with the -F # option. If set to `off', dbx loads # the program approximately 15% faster. # Default: off dbxenv disassembler_version <autodetect | v8 | v9 | v9vis> # SPARC: # # Set the version of dbx's built-in # disassembler for SPARC V8, V9, or V9 with # the Visual Instruction set. Default: # autodetect, which sets the mode # dynamically depending on the type of # machine a.out is running on. # # non-SPARC: # # Only choice is autodetect. # dbxenv fix_verbose <on | off> # Governs the printing of the compilation line # during a `fix'. Default: off dbxenv follow_fork_inherit <on | off> # When following child ... (Solaris 2.x) follow_fork_inherit on # ... inherit events follow_fork_inherit off # ... don't inherit events. Default: off dbxenv follow_fork_mode <parent | child | both ask> # When process executes a fork/vfork/fork1 ... follow_fork_mode parent # ... stay with parent follow_fork_mode child # ... follow child follow_fork_mode both # ... follow both parent and child (WorkShop only) follow_fork_mode ask # ... ask which of the above the user wants # Default: parent dbxenv follow_fork_mode_inner <unset | parent | child | both> # Only of relevance after a fork has been # detected and if follow_fork_mode was set to # 'ask', and you chose 'stop'. By setting this # variable you need not use "cont -follow ...". dbxenv input_case_sensitive <autodetect | true | false> # If set to `autodetect', dbx automatically # selects case sensitivity based on the language # of the file: `false' for fortran files, # otherwise `true'. If true, case # matters in variable and function names; # otherwise, case is not significant. # Default: autodetect dbxenv language_mode <autodetect | main | c | ansic | c++ | objc | pascal | fortran | fortran90> # Governs the language used for parsing and # evaluationg expressions. See also # `help language'. # # mode `autodetect': sets expression # evaluation language to language of current # file. Useful if debugging programs with # mixed languages (default mode). # mode `main': sets expression evaluation # language to the language of the main routine # in the program. Useful if debugging # homogeneous programs. # mode `c', `c++', `ansic', `c++', `objc', # `pascal', `fortran', `fortran90' : sets # expression language to selected language. dbxenv locache_enable <on | off> # Enable or disable loadobject cache entirely # Default: on dbxenv mt_watchpoints <on | off> # Allow or disallow watchpoint facility for # MT programs. Default: off # (Warning: Be aware that when using watchpoints # on an MT program that the application may # deadlock if a semaphore occurs on a page # that is being watched.) dbxenv output_auto_flush <on | off> # Automatically call fflush() after each `call' # Default: on dbxenv output_base <8 | 10 | 16> # Default base for printing integer constants # Default: 10 dbxenv output_dynamic_type <on | off> # When on, `-d' is the default for printing # and displaying. Default: off dbxenv output_inherited_members <on | off> # When on, `-r' is the default for printing # and displaying. Default: off dbxenv output_list_size # Governs the default number of lines to print # in the list command. Default: 10 dbxenv output_log_file_name <filename> # Name of the command logfile. # Default: /tmp/dbx.log.<uniqueID> dbxenv output_max_string_length <num> # Set # of chars printed for `char *'s. # Default: 512 dbxenv output_pretty_print <on | off> # When `on', `-p' is the default for printing # and displaying. Default: off # See `help prettyprint'. dbxenv output_short_file_name <on | off> # Display short pathnames for files. # Default: on dbxenv overload_function <on | off> # If on, do automatic function overload # resolution (C++ only). Default: on dbxenv overload_operator <on | off> # If on, do automatic operator overload # resolution (C++ only). Default: on dbxenv pop_auto_destruct <on | off> # If on, automatically call appropriate # destructors for locals when popping a frame. # Default: on dbxenv rtc_auto_continue <on | off> # Log RTC errors to rtc_error_log_file_name # and continue. Default: off dbxenv rtc_auto_suppress <on | off> # If on, an RTC error at a given location is # reported only once. Default: on dbxenv rtc_biu_at_exit <on | off | verbose> # Used when `check -memuse' is on explicitly or # via `check -all'. If the value is `on', a non-verbose # memory use (blocks in use) report is produced # at program exit. If `verbose', a verbose report # is produced at program exit. If `off', no output # is produced. This variable has no effect on the # `showmemuse' command. See also `help check' and # `help showmemuse'. Default: on dbxenv rtc_error_limit <num> # Number of RTC errors that will be reported. # Default: 1000 dbxenv rtc_error_log_file_name <filename> # Name of file where RTC errors are logged # if `rtc_auto_continue' is set. # Default: /tmp/dbx.errlog.<uniqueID> dbxenv rtc_mel_at_exit <on | off | verbose> # Used when leaks checking is on. # # If the value is `on', a non-verbose memory # leak report is produced at program exit. # If `verbose', a verbose memory leak report is # produced at program exit. If `off', no output # is produced. This variable has no effect on the # `showleaks' command. Default: on dbxenv run_autostart <on | off> # If on and there is no active program, `step', # `next', `stepi', and `nexti' implicitly # run the program and stop at the language- # dependent "main" routine, and `cont' implies # `run' whenever necessary. # Default: off dbxenv run_io <stdio | pty> # Governs whether the user program's I/O is # redirected to dbx's stdio or a specific pty. # The pty is provided via $DBX_run_pty. # Default: stdio dbxenv run_pty <ptyname> # Sets the name of the pty to use when # $DBX_run_io is set to `pty'. Ptys are # mainly used by GUI wrappers for dbx. dbxenv run_quick <on | off> # If on, no symbolic information is loaded upon # 'debug'. The symbolic information can be # loaded on demand using "prog -readsysms". # Until then dbx behaves as if the program # being debugged is stripped. # Default: off dbxenv run_savetty <on | off> # Multiplexes tty settings, process group, and # keyboard settings (if -kbd was used on the # command line) between dbx and the debuggee; # useful when debugging editors and shells. # Set it to `on' if dbx gets SIGTTIN or SIGTTOU # and pops back into the shell. Setting it to # `off' to gain a slight speed advantage. # The setting is irrelevant if dbx attached # to the debugee or is running under WorkShop. # Default: on dbxenv run_setpgrp <on | off> # If on, when a program is `run' `setgprp(2)' # is called right after the fork. # Default: off dbxenv scope_global_enums <on | off> # If on, enumerators are put in global scope # and not in file scope. Set before # debugging information is processed # (~/.dbxrc). Default: off dbxenv scope_look_aside <on | off> # Find file static symbols, even when not in # scope. Default: on dbxenv session_log_file_name <filename> # Name of the file where dbx logs all # commands and their output. Output is # appended to the file. # Default: "" (no session logging) dbxenv stack_max_size <num> # Set the default size for the `where' command. # Default: 100 dbxenv stack_verbose <on | off> # Governs the printing of arguments and # line information in `where'. # Default: on dbxenv step_events <on | off> # Allow breakpoints while step/next'ing. # Default: off dbxenv suppress_startup_message <num> # Set the release level below which the startup # message is not printed. Default: 3.01 dbxenv symbol_info_compression <on | off> # Read debugging information for each include # file only once, and create the common block # symbol table for FORTRAN only once. # Default: on dbxenv trace_speed <num> # Set the speed of tracing execution. Value is # number of seconds to pause between steps. # Default: 0.50 Each of the above has a corresponding ksh environment variable such as DBX_trace_speed. The variable may be assigned directly, or the dbxenv command may be used; they are equivalent. The following obsolete names are recognized as aliases: Old name New name autocontinue rtc_auto_continue autoflush output_auto_flush autosuppress rtc_auto_suppress case input_case_sensitive compress_stabs symbol_info_compression dynamic_type output_dynamic_type errlogfile rtc_error_log_file_name error_limit rtc_error_limit func_overload overload_function lo_cache locache_enable logfile output_log_file_name lookaside scope_look_aside oper_overload overload_operator pop_autodestruct pop_auto_destruct setpgrp run_setpgrp shortfname output_short_file_name speed trace_speed stackmaxsize stack_max_size stackverbose stack_verbose stepevents step_events stringlen output_max_string_length warnings symbol_info_warnings


debug

debug # Print the name and arguments of the program being debugged (ee also `help prog') debug <prog> # Begin debugging <prog> with no process or core. debug -c <core> <prog> # Begin debugging <prog> with corefile <core>. debug -p <pid> <prog> # Begin debugging <prog> with process ID <pid>. debug <prog> <core> # Begin debugging <prog> with corefile <core>. debug <prog> <pid> # Begin debugging <prog> with process ID <pid>. On Solaris 2.x, <prog> may be `-'; dbx finds the a.out using /proc debug -f ... # Force loading of corefile, even if it doesn't # match. debug -r ... # The `-r' option causes dbx to retain all display's, trace's, when's, and stop's. With no `-r' option, an implicit `delete all' and `undisplay 0' is performed. debug -clone ... # The `-clone' option causes another dbx to begin execution, permitting debugging of more than one process at a time. Valid only if running under the GUI. debug -clone # Starts another dbx debugging nothing. Valid only if running under the GUI. debug [<options>] -- <prog> # Start debugging <prog>, even if <prog> begins with a dash.


debug clone

debug -clone ... # The `-clone' option causes another dbx to begin execution, permitting debugging of more than one process at a time. Valid only if running under the GUI. debug -clone # Starts another dbx debugging nothing. Valid only if running under the GUI.


delete

delete [-h] <number> ... # Remove trace's, when's, or stop's of given # number(s). To remove hidden handlers, # -h option must be given. delete [-h] 0 | all | -all # Remove all trace's, when's, and stop's exluding # permanent and hidden handlers. Specifying -h # removes hidden handlers as well. delete -temp # Remove all temporary handlers


detach

detach # Detach dbx from the targe, and cancel any # pending signals. detach -sig <sig> # Detach while forwarding the given signal.


dis

dis <addr> [/ <count>] # Disassemble <count> instructions (default is 10), starting at address <addr>. dis <addr1>, <addr2> # Disassemble instructions from <addr1> through <addr2>. dis # Disassemble 10 instructions, starting at the value of `+' (see `help examine'). dis /<count> # Disassemble <count> instructions, starting at `+'.


display

display # Print the list of expressions being displayed display <exp>, ... # Display the value of expressions <exp>, ... at every stopping point display [-r|+r|-d|+d|-p|+p|-f<fmt>|-F<fmt>|--] <exp>, ... See `help print' for flags. See also `help undisplay'.


document

document <cmdname> # Provides the documentation for <cmdname>. The `document' command reads from standard input. To add documentation for a new command named `foo', use (dbx) document foo foo <arg> # Echoes the <arg> with each letter converted to upper case. ^D Type Control-D to end the input. To remove the documentation for command `foo', use (dbx) document foo </dev/null


down

down # Move down the call stack one level down <number> # Move down the call stack <number> levels down -h [<number>] # Move down the call stack, but don't skip hidden frames


dump

dump # Print all variables local to the current procedure dump <proc> # Print all variables local to <proc>


edit

edit # Edit the current file edit <filename> # Edit the specified file <filename> edit <proc> # Edit the file containing function or procedure <proc> `edit' uses $EDITOR if dbx is not running under the GUI. Otherwise, it sends a message to the GUI to display the appropriate file.


editing

Use either `help editing emacs' or `help editing vi'


editing emacs

Use `set -o emacs' to enable the emacs-style editor. The `bind' command lists the current key bindings or change the bindings. Some of the more important default bindings are: ^A = beginning-of-line ^B = backward-char ^D = eot-or-delete ^E = end-of-line ^F = forward-char ^G = abort ^K = kill-to-eol ^L = redraw ^N = down-history ^P = up-history ^R = search-history ^^ = quote ^? = delete-char-backward ^H = delete-char-backward ^[b = backward-word ^[d = delete-word-forward ^[f = forward-word ^[^H = delete-word-backward ^[^[ = complete ^[? = list-command


editing vi

Use `set -o vi' to enable the vi-style editor. The commands (in command mode) ares: a = append A = append at EOL c = change d = delete G = goto line h = backward char i = insert I = insert at BOL j = next line k = prev line l = forward line n = next match N = prev match p = put after P = put before r = repeat R = replace s = substitute u = undo x = del char X = del prev char y = yank ~ = transpose case _ = last arg * = expand = = list expansion - = prev line + = next line sp = forward char # = comment out command ? = search history from beginning / = search history from current In insert mode, the following keystrokes are special: ^? = delete char ^H = delete char ^U = kill line ^W = delete word


env

# See `help environment'.


environment

Certain environment variables affect dbx if defined at invocation time: TMPDIR Use instead of /tmp on all dbx temp files dbx specific environment variables have a "DBX_" prefix. The prefix "_DBX_" has been reserved for internal environment variable names. See `help ksh environment' and `help dbxenv'.


eval

eval <cmd> [<args>] # Evaluate the command <cmd> as if it had been entered from the keyboard. This is useful when a command must be composed programmatically, then executed. Example: (dbx) x='echo $$' (dbx) $x $$ (dbx) eval $x 1234


event

Subtopics for `help event <subtopic>': specification Description of all recognized event specifications. fault Fault specifications. sig Signal specifications. variables Built-in variables which are related to events. modify Watchpoints. (Solaris 2.x) See also `help events'.


event fault

Hardware fault specification. You can use a decimal number, the fault name in uppercase or lowercase, optionally prefixed by `flt', such as: 8 izdiv IZDIV fltizdiv FLTIZDIV


event modify

(Solaris 2.x) This is the general`watchpoint facility. Watchpointing is the ability of dbx to fire an event note when the value of a variable or expression has changed. To use watchpoints, use one of: stop|when|trace modify <addr-exp> [ , <byte-size-exp> ] <addr-exp> is any expression that can be evaluated to produce an address. If a symbolic expression is used the size of the region to be watched is automatically deduced, or you can override that with the `,' syntax. You can also use non-symbolic, typeless address expressions in which case the size is mandatory, such as: stop modify 0x5678, sizeof(Complex) There are actually two styles of watchpoints in dbx. The older, slower, style uses automatic single stepping and is invoked using: stop|when|trace cond <cond-expr> stop|when|trace change <variable>


event sig

Signal specification. You can use a decimal number and the signal name in uppercase or lowercase, optionally prefixed by `sig', such as: 11 segv SEGV sigsegv SIGSEGV A signal sub-code can be added. You can use a decimal number, the sub-code name in uppercase or lowercase. The prefix consisting of the signal name and an `_' can be dropped. 3 fltdiv FLTDIV fpe_fltdiv FPE_FLTDIV For a list of signals and their sub-codes, use `help signals'.


event spec

See `help event specification'


event specification

An event specification is used by the event management commands stop, when, and trace to specify an event of interest. It has the following general syntax: <keyword> [ <arg> ] [ <modifier> ... ] The keyword specifies the kind of event; the most common being 'at' and 'in'. Certain events take additional arguments as demonstrated below. Modifiers begin with a `-' and may be applied to all event types. The following list predefined events was introduced pre-SPARCworks 3.1: in <func> # entry into <func> at <line> at <filename>:<line> # <line> is about to be executed # Sometimes dbx has problems setting a breakpoint # at a specific line in header files (in C++ inline # functions or template definitions) if debugging # information has not been read for at least one # instance of the function. If dbx cannot set the # breakpoints, do a `func <name_of_function>' to # force dbx to read the debugging information, and # try to re-type the command. inmethod <func> # entry into any method named <func> inmember <func> # an alias of `inmethod' infunction <func> # entry into any overloaded version of <func> inclass <classname> # entry into any method of <classname> where # <classname> is a C++ struct, union, class, or # template class inobject <class_object_expression> # entry into any non-static method of the # class and all its baseclasses when called # from the object. <class_object_expression> # should evaluate to an C++ object. The following list of predefined events was introduced in SPARCworks 3.0: modify <addr-expr> [ , <byte-size-expr> ] # The given address range has been written to (see # `help event modify'). Any expression can be used # for <addr-expr> but it has to evaluate to an address. # (Solaris 2.x) step # A single step has occurred # Specifying this event implicitly turns on stepping. next # A next has occurred sig <sig> # The specified signal has been intercepted (see # `help event sig') sig <sig> <code> # The signal with the given signal sub-code has been # intercepted (see `event sig' for more info) fault <fault> # The specified fault has been intercepted (see # `help event fault') throw # A C++ exception has been thrown throw <type> # A C++ exception of type <type> has been thrown stop # The process has stopped; user is about to get prompt attach # An attach operation has just completed sync # The target process has just execed and synchronized # with dbx. `stop sync' is ineffective, although you # can still use `when sync' syncrtld # rtld has run and all loadobject symbols have been # loaded by dbx. Same restriction regarding `stop' # applies as with the `sync' event. lastrites # The process is about to expire dlopen # A set of loadobjects has been loaded dlopen [ <lib-path> ] # The specified loadobject has been loaded. The full # path name of the library has to be quoted for <lib-path>. dlclose ... # Similarly for dlclose. exit [ <exitcode> ] # The process has exited with any exit value, or # the specified one. <exitcode> has to be a decimal. sysin # The process has entered a system call. (Solaris 2.x) sysout # A system call has returned. (Solaris 2.x) sysin <code>|<name> sysout <code>|<name> # Entry to or return from the system call of the given # number or name. See <sys/syscall.h> for list of # system calls. (Solaris 2.x) returns <func> # The specified function has returned. returns # The current visiting function has returned. The following list of predefined events was introduced in dbx 4.0: detach # Complements 'attach' lwp_exit # Notifies of the demise of the lwp given in $lwp proc_gone # Fires when dbx is no longer associated with a debugged # process. The event variable $reason can be: signal, # exit, kill, or detach. prog_new # Fires when a new program is loaded into dbx. This # occurs during the debug command or when follow- # exec occurs. Since all handlers get deleted across # debug, it only makes sense to create this handler # with the -perm modifier timer <seconds> # The debugee has been running for <seconds> realtime # seconds. <seconds> is a floating-point number. # dbx's single interval timer is also shared by the # data visualizer and the Collector commands. Using one # of these features excludes the others. change <variable> # Value of <variable> has changed. cond <cond-expr># Condition has changed. Any expression can be used # but it has to evaluate to an integral type. For backward compatibility, the following syntactical variations of eventspecs (note that they lack the 'keyword') are accepted although they are considered anachronistic and will be eliminated in future releases. <variable> # Value has changed. Use 'change <variable>' instead. <cond-expr> # Condition has changed. Any expression can be used # but it has to evaluate to an integral type. Use # 'cond <cond-expr>' instead. The following is a list of eventspec modifiers: -if <cond> # Event only fires when the <cond> `filter' is true. # Any expression can be used for <cond> as long as # it evaluates to an integral type. -in <func> # Event only fires if it occurs in function <func>. -disable # Create the event in the disabled state. -count <n> # Count up from 0; event fires and counter is reset # to 0 when <n> is reached. -count infinity # Count, but don't fire. -temp # A temporary event, deleted when fired. -instr # Do instruction level variation. For example, # `step' becomes instruction level stepping, and `at' # takes a text address for an argument instead of # a line number. -perm # Make this event "permanent" across `debug'. # Certain events (like breakpoints) are not appropriate # to be made permanent. 'delete all' will not delete # permanent handlers, use 'delete <hid>'. -hidden # Hide the event from the `status' command. Some # import modules may choose to use this. Use 'status -h' # to see them. -lwp <lwpid> # Event only fires if it occurs in the given LWP. (Solaris 2.x) -thread <tid> # Event only fires if it occurs in the given thread. (Solaris 2.x) For backward compatibility, the following syntactical variations of eventspec modifiers are also accepted, although they are considered anachronistic and will be eliminated in future releases. if <cond> in <func> <lwpid> (Solaris 2.x) <tid> (Solaris 2.x)


event variables

The following read-only predefined variables represent the current state of dbx. They are always valid. They follow the current LWP or thread. $ins # disassembly of the current instruction $lineno # current line number in decimal $vlineno # current `visiting` line number in decimal $line # contents of the current line $func # name of the current function $vfunc # name of the current `visiting' function. $class # name of the class to which $func belongs. $vclass # name of the class to which $vfunc belongs. $file # name of the current file $vfile # name of the current file being visited. $loadobj # similarly for loadable object $vloadobj # ... $scope # The scope of the current PC in back-quote notation. $vscope # ... $funcaddr # Address of $func in hex $caller # name of the function calling $func $newhandlerid # The event ID of the handler most recently created. $proc # The process ID of the current process being debugged. $lwp # The LWP ID of the current LWP (MT only) $thread # The thread ID of the current Thread (MT only) $prog # The full path-name of the loaded program. $oprog # Previous value of $prog. Very useful after # follow-exec, when $prog reverts to "-". $dllist # list of all load objects last dlopen'ed or dlclose'd. $exception # a pointer to the current C++ exception, or 0 if none $exitcode # The exit status from the last run of the program. # This value is an empty string if the process hasn't # actually exited. The following are only valid within the body of a WHEN: $handlerid # During the execution of the body $handlerid is the # ID of the WHEN command to which the body belongs. $booting # Is set to 'true' if the event occurs during the # "boot" process. Whenever a new program is debugged, # it is first booted so that the list and location of # shared libraries can be ascertained. The process is # then killed. # While booting happens "behind the users back", # contributing the the "Reading symbolic information # for libc.so.1" messages, all events are still # available. Use this variable to distinguish, for # example, the 'sync' and the 'syncrtld' events occuring # during a 'debug' and the ones occuring during a # normal 'run'. The following are only valid within the body of a WHEN and are event specific. For event sig: $sig # signal number that caused the event $sigstr # name of $sig $sigcode # subcode of $sig if applicable $sigcodestr # name of $sigcode $sigsender # pid of sender of the signal if relevant, 0 otherwise For event exit: $exitcode # argument passed to exit(). This value is also valid # outside a WHEN body. See above. For event modify (Solaris 2.x): $falsehits # no of false hits of a watchpoint since last firing. For events sysin and sysout (Solaris 2.x): $syscode # system call code $sysname # system call name as defined in <sys/syscall.h> For events dlopen and dlclose (only if a param was provided): $dlobj # loadobject that cause the event For event proc_gone: $reason # reason the process went away. Can be 'signal', # 'exit', 'kill', or 'detach'


events

When an event occure, dbx allows you to stop a process, execute arbitrary commands, or print information. The simplest example of an event is a breakpoint. Examples of other events are faults, signals, system calls, dlopen's and watchpoints. The following commands create `handler's for events, each with a specific side-effect: stop <eventspec> # stop and prompt the user when the specified # event occurs when <eventspec> { <cmd> ; [ ... ] } # execute commands when specified event occurs trace <eventspec> # Print a "trace" of the given event For a complete list of events, their definitions and the <eventspec> syntax accepted by the `stop', `when' and 'trace' commands, see `help event specification'. The above commands return the ID of the handler they create, <hid>. The ID can be used in the following commands. `all' can usually be substituted for <hid>. status [ <hid> ] # list the specified handler; all, if none specified handler -disable <hid> # disable the specified handler handler -enable <hid> # enable the specified handler handler -reset <hid> # reset <hid>'s counter (see `help event specification') delete <hid> # delete the specified handler clear <lineno> # delete any handler on the specified line. clear # shorthand for `clear $lineno' See also `help event'.


eventspec

See `help event specification'


examine

examine [ <addr> ] [ / [ <count> ] [ <fmt> ] ] Display the contents of memory starting at <addr> for <count> items in format <fmt>. The default <addr> is the next one after the last address previously displayed. The default <count> is 1. The default <fmt> is the same as was used in the previous `examine' command, or `X' if this is the first one. examine <addr1> , <addr2> [ / [ <fmt> ] ] Display the contents of memory from <addr1> through <addr2> inclusive, in format <fmt>. examine <addr> = [ <fmt> ] Display the address (instead of the contents of the address) in the given format. The <addr> may be `+' which indicates the address just after the last one previously displayed (the same as omitting it). `x' is a predefined alias for `examine'. Legal values for <fmt> are: 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)


exception

exception [-d | +d] # Prints the value of the current C++ exception, if any. See `help print' for the meaning of the `-d' flag. See also `help whocatches' and `help event specification'.


exec

exec <cmd> [<args>] # Causes dbx to exec() the given command. This results in dbx being terminated and the new command running with the same process ID.


exists

exists <name> # Returns 0 if <name> is found in the current program, 1 if <name> is not found


exit

exit # Causes dbx to exit with return code 0. Same as `quit'. exit <n> # Exit with return code <n>. Same as `quit <n>'.


export

export # Lists all exported ksh variables export <name> # Marks the variable <name> as exported export <name>=<value> # Marks the variable <name> as exported and assigns it a new value export <name1> <name2>... # Marks the given variables as exported export <n1>=<v1> <n2>=<v2>... # etc. An exported variable has the attribute `-x' (see `help typeset').


f77

See `help fortran'


f90

See `help fortran'


false

false # Does nothing and returns non-zero (255)


fc

fc # (Fix Command) Invokes the editor ($FCEDIT) on the most recent command. The result is executed when you leave the editor. See `help ksh FCEDIT' for more info. fc -e <editor> # Use <editor> instead of $FCEDIT to edit the previous command fc -l # Lists the last 16 commands in the history fc -ln # Lists the last 16 commands without history numbers fc -lr # Lists the last 16 commands in reverse order fc -e - <cmd> # Reexecute previous command which matches <cmd>. <cmd> may be a positive number (the history number), a negative number (subtracted from the current history number), a string (matches the most recent command starting with the given string), or nothing (meaning the previous command). The builtin alias `r' is set to `fc -e -'. fc -e - <old>=<new> <cmd> # Like the above, but substitutes <new> for <old> before executing the command fc -e -g - <old>=<new> <cmd> # Globally substitute <new> for <old>


fg

fg # Put the current job into the foreground fg %+ # Put the current job into the foreground fg %- # Put the previous job into the foreground fg %<n> # Put job number <n> into the foreground fg %<str> # Put the job which begins with <str> into the foreground fg %?<str> # Put the job which contains <str> into the foreground The `%' is optional in all cases.


file

file # Print the name of the current file file <filename> # Change the current file


files

files # List the names of all files that contributed debugging information to the current program (those which were compiled `-g') files <regexp> # List the names of all `-g' files which match the given regular expression


fix

Use `fix' to make changes to your program given. `fix' recompiles modified source files and dynamically links the modified functions into the application. fix # Fix the current file fix <filename> <filename> ... # Fix files in list fix -f # Force fixing the file, even if source hasn't been modified fix -a # Fix all modified files fix -g # Strip -O flags and add -g flag fix -c # Print compilation line (may include some options added internally for use by dbx) fix -n # No execution mode fix -v # Verbose mode (overrides dbxenv setting) fix +v # Non-verbose mode (overrides dbxenv setting) See `help _cb_fix_comp' and `help _cb_fix_link' for how to customize the compilation and link steps. See `help fix-pitfalls' and `help dbxenv' under `fix_verbose' for more information.


fix-pitfalls

Fix and Continue Restrictions and Precautions --------------------------------------------- You can modify sources in the following ways when using Fix and Continue: o Add, delete, or change lines of code in functions o Add or delete functions o Add or delete global and static variables Restrictions ------------ dbx might have problems when functions are mapped from the old file to the new file. To minimize such problems when editing a source file, be careful not to: o Change the name of a function o Add, delete, or change the type of arguments to a function o Add, delete, or change the type of local variables in functions currently active on the stack (see `pop' for more information) o Only the body of a C++ template function definition can be modified. Any changes to the declaration of a template or to template instances requires a complete remake of the program o Fixing shared object files (.so) may require a change in the source of the a.out. Shared objects have to be dlopen'ed in a special mode ('RTLD_NOW|RTLD_GLOBAL' or 'RTLD_LAZY|RTLD_GLOBAL') in order for Fix and Continue to work correctly. This procedure works only for Solaris 2.3 or newer. Precautions ----------- Resuming program execution after performing a Fix and Continue can cause errors that may not be directly related to the actual modifications to the source. Before resuming program execution after you have modified the source, you should be aware of the following conditions: o If a function being modified is already instantiated on the stack (not the top frame), the program executes the old code (the unmodified code) when returning to that frame. o Breakpoints in already instantiated functions on the stack in the old code are lost. o Changes made to global variables are not undone by the pop or fix command. Use `assign' to manually reassign correct values to global variables. o Values of static variables are normally retained across fixes. However, if the file was not originally compiled with debugging information, static variables in that file are reinitialized after each fix. Use `assign' to manually reassign correct values to static variables. o If the number of lines of source code are changed due to your edits, the placement of the breakpoints might be incorrect. dbx warns you that the breakpoints have moved to a new line. You should check the locations of the breakpoints with the status command in the new code before running the program. o The program counter is moved to the beginning of the same line in the new (fixed) function. If the function has been modified, the program counter can end up at a wrong line. In that case, do one of the following: o Use the `pop' command. It pops one or more frames from the stack. Then `cont' to re-enter the function. o Use `cont at <linenum>' to continue from another line (effectively moving the pc before executing). o Manually repair data structures (using `assign') before continuing. o Rerun the program. o If you change a C++ template definition, you must issue the fix command on all files that define instances of that template.


fixed

fixed # List names of all fixed files


follow-fork

(Solaris 2.x) dbxenv follow_fork_mode ... # When process executes a fork/vfork/fork1 ... dbxenv follow_fork_mode parent # ... stay with parent (default) dbxenv follow_fork_mode child # ... follow child dbxenv follow_fork_mode both # ... follow both parent and child (GUI only) dbxenv follow_fork_mode ask # ... ask which of the above the user wants dbxenv follow_fork_inherit ... # When following child ... dbxenv follow_fork_inherit on # ... inherit events dbxenv follow_fork_inherit off # ... don't inherit events (default)


format

The `print', `rprint', and `display' commands and the `$[]' construct take a flag (`-f' or `-F') which sets the output format for integer, string, or floating point types. This format is used when dbx is about to print an integer (long or short), string (char * or wchar_t *), or floating-point (float, double, long double) expression. That is, the expression itself may be a structure or array; each integer, string, or floating-point member will be printed using the given format, if applicable. If the format does not apply to the given type, the format string is silently ignored and dbx uses its built-in printing mechanism. The allowed formats are a subset of those used by `printf(3S)'. The following restrictions apply: No `n' conversion. No `*' for field width or precision. No `%<digits>$' argument selection. Only one conversion specification per format string. The allowed forms are defined by the following simple grammar: FORMAT ::= CHARS % FLAGS WIDTH PREC MOD SPEC CHARS CHARS ::= <any character sequence not containing a %> | %% | <empty> | CHARS CHARS FLAGS ::= + | - | <space> | # | 0 | <empty> WIDTH ::= <decimal number> | <empty> PREC ::= . | . <decimal number> | <empty> MOD ::= h | l | L | ll | <empty> SPEC ::= d | i | o | u | x | X | f | e | E | g | G | c | wc | s | ws | p If the given format string does not contain a %, dbx automatically prepends one. If the format string contains spaces, semicolons, or tabs, the entire format string must be surrounded by double quotes. Examples: (dbx) print i i = 31 (dbx) print -fx i ;# the format string may be concatenated with the -f i = 1f (dbx) print -f 0x%12.12X 1234 0x0000000004D2 (dbx) print -f "The value of 0x1000 is %o in octal" 0x1000 The value of 0x1000 is 10000 in octal (dbx) print x/10.0 ;# compare with following x/10 = 12.3 (dbx) print -F"10%% of x is %.2e" x/10.0 ;# suppress printing of left side 10% of x is 1.23e+01 (dbx) print -fx struct1 ;# it even applies to members... struct1 = { x = 7b }


fortran

Breakpoints ----------- In FORTRAN 77 the name of the MAIN program is MAIN, not main. To stop in the main program, you must use `stop in MAIN'. Expressions ----------- There is new support for parsing FORTRAN style expressions, handling complex numbers, and calling most FORTRAN intrinsic functions. It may be necessary to avoid situations such as "print 1.eq.1" by using "print 1 .eq. 1" due to the non-FORTRAN nature of dbx's token scanner.


fortran77

See `help fortran'


fortran90

See `help fortran'


forwardref

dbx correctly handles all forward references that are later defined in the current scope. For example, with the following code: struct foo; struct foo *fp; struct foo { /* stuff */ }; dbx allows you to dereference fp (eg: "print *fp"). If the forward reference is not defined in this scope dbx may have some problems handling the dereference. For example: struct bar; struct bar *bp; /* no further definition of struct bar */ dbx will not always be able to evaluate the command "print *bp". If so, you can explicitly cast the pointer to a known type such as: print *(`bar.cc`struct bar *)bp where `bar.cc' is a file that defines struct bar. In C++ this can be abbreviated to: print *(`bar.cc`bar *)bp or, as an alternative, you can issue the command "module bar.cc" and then all subsequent prints of type bar will be successful.


frame

frame # Display the frame number of the current frame frame [-h] <number> # Set the current frame to frame <number> frame [-h] +[<number>] # Go <number> frames up the stack; default is 1 frame [-h] -[<number>] # Go <number> frames down the stack; default is 1 -h # Go to frame, even if frame is hidden


func

func # Print the name of the current function func <proc> # Change the current function to function or procedure <proc>


funcs

funcs # List all functions in the current program funcs [-f <filename>] [-g] [<regexp>] -f <filename> # List all functions in file -g # List all functions with debugging information <regexp> # List all functions which match the regular expression


getopts

getopts <opts> <name> # Checks the positional parameters ($1, $2, etc.) for legal options, based on the value of <opts>, and assigns the result to <name>. <opts> is a string of option letters. If an option letter is followed by a colon (`:'), it requires an argument. See the example at `help ksh OPTARG'. getopts <opts> <name> <args>... # Use the given args rather than the positional parameters.


handler

A handler is created for each event that needs to be managed in a debugging session. The commands `trace', `stop', and `when' create handlers. Each of these commands returns a number known as the `handler ID' (<hid>). The `handler', `status', and `delete' commands manipulate or provide information about handlers in a generic fashion: handler -enable <hid> ... # enable given handlers, `all' for all handler -disable <hid> ... # disable given handlers, `all' for all handler -count <hid> # print value of trip counter for given handler handler -count <hid> <newlimit> # set new count limit for given event handler -reset <hid> # reset trip counter counter for given handler See also `help event'.


hash

hash # List the tracked aliases hash <cmd> # Make <cmd> a tracked alias hash -r # Unset all tracked aliases. When a UNIX command is executed, if the `hashall' option is set and the command was given as a simple name (no slashes), then the name is entered as a tracked alias for the pathname corresponding to the executed program.


havegui

If dbx is running under the GUI, `$havegui' has the value `true'; otherwise it is `false'.


help

help # Print a summary of the builtin dbx commands help <cmd> # Print help about <cmd> help <topic> <subtopic> # Print help for topic and subtopic help -k <keyword> # Print name of each topic which contains <keyword> When dbx is not running under the GUI, `help' output is piped through $PAGER, if set, or /usr/ucb/more, if it is present and $PAGER is not set. (The value of $PAGER must be a full path name if the `path' option is not set.) To disable this feature, put `unalias help' in your .dbxrc file. Use the `commands' command to see a one-line summary of all commands. See `help changes' for new and changed features. The path to an HTML version of the helpfile is available in $helpfile_html. Type `mosaic $helpfile_html' to browse the helpfile using mosaic (if you have mosaic available on your system). To print the path, type `echo $helpfile_html'. The path to the ascii version is available in $helpfile.


hide

hide # List the stack frame filters currently in effect hide <regexp> # Hide stack frames matching <regexp> The regular expression matches either the function name, or the name of the loadobject, and is a sh or ksh file matching style regular expression. See also `help unhide'.


history

history # Print a list of the most recent commands history <num> # Resize the history list to hold <num> commands history - # Stop recording commands in the history history + # Resume recording commands


ignore

ignore # Print a list of the ignored signals ignore <num>... # Ignore signal(s) numbered <num> ignore <sig>... # Ignore signal(s) named by <sig> # SIGKILL cannot be caught or ignored. # See also `help catch'.


import

import <pathname> # Import commands from the dbx command library <pathname>.


intercept

used with C++. intercept <typename> # Intercept throws of type <typename>. intercept -a # Intercept all throws. intercept -x <typename> # Do not intercept <typename> intercept -a -x <typename> # Intercept all types except <typename> intercept # List intercepted types. See also `throw' under `help event specification' and `help unintercept'.


invocation

dbx recognizes the following command-line options: -c <cmds> # Execute <cmds> before prompting for input -C # Preload the Runtime Checking library (see `help check') -d # Used with -s, removes <file> after reading -f # Force loading of corefile, even if it doesn't match. -F # Enable Cfront demangling -h # Print the usage help on dbx -I <dir> # Add <dir> to `pathmap' set (see `help pathmap') -k # Save and restore keyboard translation state -q # Suppress messages about reading stabs -r # Run program; if program exits normally, exit -R # Print the readme file on dbx -s <file> # Use <file> instead of .dbxrc or .dbxinit -S # Suppress reading of site-specific init file -V # Print the version of dbx -w <n> # Skip <n> frames on `where' command. -- # Marks the end of the option list; use this if the # program name starts with a dash The following options are for debugging dbx: -e # Echo each command before execution If `-r' is used, the program's arguments follow the name of the program. In all other cases, the program name must be last, or be followed by the name of a corefile or a process ID. dbx [options] <prog> # Debug <prog> dbx [options] <prog> <core> # Debug <prog> with corefile <core> dbx [options] <prog> <pid> # Debug <prog> with process ID <pid> dbx [options] - <pid> # Debug process ID <pid>; dbx finds # the program via /proc (Solaris 2.x) dbx [options] -r <prog> <args> # Run <prog> with arguments <args>; # if abnormal termination, start # debugging <prog>, else just exit


jobs

jobs # List all active jobs. The list includes the job number, an indicator of the current (`+') and previous (`-') job, the process ID, a status indicator (`Stopped', `Running', `Done', `Signal <n>'), and the first several characters of the command. See `help fg' and `help bg' for more information.


kalias

kalias # (Korn alias) List all currently defined aliases kalias <name> # List the definition, if any, of alias <name> kalias <name>=<def>... # Define <name> to be an alias for <def>. <def> must be quoted if it contains white space. See also `help alias' and `help dalias'.


kill

kill -l # List all known signal numbers, names, and descriptions kill # Kill the controlled process kill <job>... # Send the SIGTERM signal to the listed jobs kill -<sig> <job>... # Send the given signal to the listed jobs <job> may be a process ID or may be specified in any of the ways listed under `help fg', but the `%' is not optional in this case.


kprint

kprint <arg>... # (Korn print) Echo the arguments kprint -n <arg>... # Echo the arguments, without a trailing newline kprint -e <arg>... # Echo the arguments, expanding backslash escapes (default setting) kprint -r <arg>... # Echo the arguments, without expanding backslash escapes (see `help ksh backslash') kprint -u <n> <arg>... # Echo the arguments to file descriptor <n> kprint - <arg>... # Echo the arguments. This ensures that <arg> is not treated as an option, even if it starts with a dash (`-'). The builtin alias `echo' is equal to `kprint'.


ksh

The command syntax is that of the KornShell. Branching and looping, environment variables, history, and command-line editing are all supported. Use the command `help ksh <subtopic>' for more information on the following: aliases # the list of builtin aliases backslash # the list of backslash escapes recognized by `kprint' builtins # the list of builtin commands differences # known differences between the dbx interpreter and ksh environment # the list of predefined variables expressions # using ksh expressions, $[] language expressions, etc. options # `set -o' options syntax # a simplified ksh grammar variables # setting, testing, modifying ksh variables <varname> # usage of specific pre-defined variables Or use `help -k <keyword>' to find help topics that mention the word <keyword>.


ksh CDPATH

The CDPATH variable contains a colon-separated list of directories which will be searched for the argument of a `cd' command, if the argument does not begin with a slash. The current working directory is not searched by default if $CDPATH is set. It is null by default.


ksh COLUMNS

The COLUMNS variable should reflect the width of the terminal. It is used by the built-in command line editors.


ksh EXECSHELL

The EXECSHELL variable contains the full pathname of the default shell to use when executing scripts. The default is `/bin/sh'.


ksh FCEDIT

The FCEDIT variable contains the full path name of the default editor for the `fc' command. The implicit default is `/bin/ed'.


ksh HISTSIZE

The HISTSIZE variable contains the number of commands which will be saved in the history. Larger numbers use more memory. Default is 15.


ksh HOME

The HOME variable is the default argument for the `cd' command, the place that dbx looks for the startup files .dbxrc and .dbxinit, and the result of expanding `~' in pathnames.


ksh IFS

The IFS variable contains the `internal field separators'. These are the characters which separate parameters to commands. The default is `space', `tab', and `newline'.


ksh MAIL

The MAIL variable contains the full pathname of your incoming mail file. This file is checked periodically (see `help ksh MAILCHECK') for incoming mail if $MAILPATH is not set (which see).


ksh MAILCHECK

The MAILCHECK variable contains the minimum number of seconds that must elapse before dbx checks for incoming mail. The check is performed just before printing the prompt, if $MAILCHECK seconds have elapsed since the last check. If $MAILCHECK is null or is zero, the check is performed before each prompt. If $MAILCHECK is unset, or is set to a non-numeric value, checking for mail is disabled. The default is 600 seconds (ten minutes).


ksh MAILPATH

The MAILPATH variable contains a colon-separated list of files which will be checked for incoming mail. Each pathname may be followed by a question mark and a message to be printed. The default message is `you have mail in $_' (the $_ variable is set to the full pathname). If MAILPATH is not set, dbx checks $MAIL. It is not set by default.


ksh OLDPWD

The OLDPWD variable contains the full pathname of the previous working directory. It is initially equal to $PWD (which see).


ksh OPTARG

The OPTARG variable is set by `getopts' when it parses an option with an argument. It contains the argument, but not the option letter. For example, if the positional arguments are -a -bfoo +c -de and `getopts' is invoked as follows: while getopts ab:cdef opt do case $opt in a) aflag=on ;; b) bflag=$OPTARG ;; +c) cflag=off ;; c) cflag=on ;; d) dflag=on ;; e) eflag=on ;; f) fflag=on ;; esac done The resulting variable settings are aflag on bflag foo cflag off dflag on eflag on fflag (no change)


ksh OPTIND

The OPTIND variable is set by `getopts' to the index of the next option it will process. It is automatically set to 1 at the beginning of any function or script. You can set it by hand to force getopts to process a particular positional parameter.


ksh PATH

The PATH variable contains a colon-separated list of directories which will be searched for a command if the command name does not contain a slash and the `path' options is set. See `help path'.


ksh PPID

The PPID variable contains the process ID of the process which spawned dbx.


ksh PS1

The PS1 variable contains the `primary' prompt string. The value of $PS1 is expanded before printing, so that PS1='$PWD> ' puts the current working directory in your prompt. A `!' is replaced with the current history number. Use `!!' to get an explicit exclamation mark. The default value for $PS1 is `($0) ' (that is, the pathname by which dbx was invoked enclosed in parentheses).


ksh PS2

The PS2 variable contains the `secondary' prompt string. This prompt is displayed whenever you have pressed RETURN and the command is incomplete. The default is `> '.


ksh PS3

The PS3 variable contains the prompt string for the `select' command. The default is `#? '.


ksh PS4

The PS4 variable is currently unused by dbx.


ksh PS5

The PS5 variable contains the prompt string when in `adb' mode. The default is `ADB> '.


ksh PWD

The PWD variable contains the full pathname of the current working directory. The `pwd' command merely echoes the value of $PWD.


ksh RANDOM

The RANDOM variable implements a random number generator. Each time the value of $RANDOM is accessed, it returns an integer from 0 to 32767. You can assign to $RANDOM to seed the random number generator.


ksh REPLY

The REPLY variable is assigned your response to the `select' command.


ksh SECONDS

The SECONDS variable contains the number of seconds since dbx was invoked. You can assign to SECONDS to reset the timer to 0.


ksh aliases

The following aliases are predefined: [='\[' alias='kalias' echo='kprint' exception='print *$exception' functions='typeset -f' integer='typeset -i' nohup='nohup ' pwd='kprint -r "$PWD"' r='fc -e -' suspend='kill -STOP $$' type='whence -v' x='examine'


ksh backslash

The following character sequences are treated specially by the `kprint' command unless given the `-r' option: \a alert (bell, ASCII 007) \b backspace \c suppresses terminating newline, like `-n' option \f form feed \n newline \r carriage return \t tab \v vertical tab \\ backslash \nnn (1 to 3 octal digits) the 8-bit character whose ASCII code is nnn Backslash is also a quoting character. To echo a form feed, one of the following could be used: (dbx) kprint -n \\f (dbx) kprint -n '\f' (dbx) kprint -n "\f"


ksh builtins

The following ksh commands are built into dbx: : . [ bg bind break builtin cd continue dalias eval exec exit export false fc fg getopts hash jobs kalias kill kprint let read readonly return set sh shift test times trap true typeset ulimit umask unalias unset wait whence Use the command `help <cmdname>' for more specific help. Or use `help -k <keyword>' to find help topics that mention the word <keyword>.


ksh differences

The known differences between the dbx command interpreter and `ksh88' are: (1) No array support. (2) Unimplemented `set -o' options: allexport bgnice gmacs markdirs noclobber nolog privileged protected viraw. (3) New `set -o' options: hashall ignoresuspend path. (4) Unimplemented `typeset' options: -l, -u, -L, -R, -H, -Z. (5) A new `typeset' option, -q. (6) dbx commands are built in. (7) The `bind' command allows rebinding of editing functions. (8) Language expressions; i.e., $[p->x]. (9) C syntax for hex and octal numbers. (10) Csh-like history access. (11) Csh-like alias arguments. (12) `print' is named `kprint'. (13) New `kprint' and `read' option, -e. (14) Backquote is a dbx scope-resolution operator; use $() instead. (15) [[ expr ]] is unimplemented. (16) New pattern operators (like `@(...)') are unimplemented. (17) Co-processes are not implemented. (18) `kill' without an argument kills the target process.


ksh environment

The following standard ksh environment variables are predefined: CDPATH COLUMNS EXECSHELL FCEDIT HISTSIZE HOME IFS MAIL MAILCHECK MAILPATH OLDPWD OPTARG OPTIND PATH PPID PS1 PS2 PS3 PS4 PS5 PWD RANDOM REPLY SECONDS _ # - ? $ ! * @ See `help ksh specialvars' for the ones with non-alphanumeric names. See `help ksh <var>' for the others. There are several variables whose name starts with `DBX_'. These correspond to the `dbxenv' variables. See `help dbxenv' for a list of these variables. The read-only status variables are: dbxdir, havegui, mtfeatures, and version. See `help dbxdir', `help havegui', `help mtfeatures', and `help version' for details. The variable `last_choice' is set automatically by overload resolution. See `help last_choice' for details. The following are readonly dbx state variables: ins lineno vlineno line func vfunc class vclass file vfile loadobj vloadobj scope vscope funcaddr caller newhandlerid handlerid proc prog lwp thread (Solaris 2.x) dllist dlobj exception sig sigstr sigcode sigcodestr exitcode falsehits (Solaris 2.x) syscode sysname (Solaris 2.x) See `help event variables' for the meaning of each. Also, the names of the registers are reserved. See `help registers'.


ksh expressions

There are two types of expressions in dbx, ksh expressions and language expressions. The first type supports only 32-bit integer values and the following operators (as in C): || && | & ^ == != > < >= <= >> << + - * / % ! ~ () = += -= *= /= %= &= |= ^= <<= >>= To evaluate a ksh expression, merely wrap it in (()). The `$' is permitted but not required for a reference to a ksh variable. It must not be used on the left side of an assignment. The second type supports all the data types of the target language and most of its operators (except the assignment operators). To evaluate a language expression, wrap it in $[]. $[] can appear inside (()), but not vice versa. An expression in $[] is evaluated in the current language (see `help language'). The `print' flags are recognized; see `help print'. For example: (dbx) typeset -i x # x is stored internally as an integer (dbx) z=3 x=5 # z is (by default) a string; (()) not required (dbx) # for simple integer assignment (dbx) ((ww = z << x)) # (()) required here, spaces are permitted (dbx) echo $ww 96 (dbx) z=$[p->x[3]] # z is assigned the (string) result; p is (dbx) # a pointer in the target process (dbx) ((s = z/$[sizeof double])) # $[] embedded in (())


ksh options

The following options are recognized by `set -o'. The one-letter abbreviation, if any, is in parentheses. emacs emacs editing mode errexit (-e) exit if an error occurs hashall (-h) remember full path for all UNIX commands executed ignoreeof do not exit on end-of-file interactive (-i) stdin is a terminal keyword (-k) treat var=value as an assignment even in an argument list monitor (-m) run background jobs in different process group noexec (-n) suppress execution of commands noglob (-f) suppress expansion of wildcards nounset (-u) report an error if an unset variable is referenced path search the $PATH if command is not found stdin (-s) take commands from stdin trackall (-h) same as `hashall' verbose (-v) echo each command before execution vi vi editing mode xtrace (-x) echo command after evaluation but before execution


ksh specialvars

The following special variables are predefined: $_ The last argument of the previous simple command, also the pathname of the mailfile when checking for mail $# The number of positional parameters, $1 ... $- The set of options which were supplied at invocation $? The return value of the last command executed, 0 to 255. If greater than 127, indicates that the command was terminated by a signal. The signal number is equal to $? minus 128. $$ The process ID of this dbx process $! The process ID of the last background process $* The positional parameters $@ The positional parameters The last two are equivalent except when quoted. "$*" yields one argument with the positional parameters separated by spaces. "$@" yields n arguments, each quoted with "". If the positional parameters are: a hi there foo (that is, three parameters, one containing a space), "$*" is equal to "a hi there foo" whereas "$@" is "a" "hi there" "foo"


ksh syntax

The following rules do not constitute a formal grammar. They merely describe the common syntactic forms in a simplified manner. PIPELINE ::= CMDLIST [ | CMDLIST ]... CMDLIST ::= COMMAND | CMDLIST [ && PIPELINE ]... | CMDLIST [ || PIPELINE ]... | CMDLIST [ ; PIPELINE ]... | CMDLIST & [ PIPELINE & ]... | ( CMDLIST ) | { CMDLIST ; } | FUNCTIONDEF FUNCTIONDEF ::= function IDENT { CMDLIST; } | IDENT () { CMDLIST; } COMMAND ::= if CMDLIST; then CMDLIST; [ elif CMDLIST; then CMDLIST; ]... [ else CMDLIST; ] fi | case WORD in [ PATTERN ) CMDLIST ;; ]... esac | for IDENT [ in WORD... ] ; do CMDLIST; done | select IDENT [ in WORD... ] ; do CMDLIST; done | while CMDLIST; do CMDLIST; done | until CMDLIST; do CMDLIST; done | when WHENARGS { CMDLIST; } | (( EXPRESSION )) | time PIPELINE | IDENT=VALUE... COMMAND | FUNCTIONCALL | BUILTIN | UNIXCMD


ksh variables

Ksh variables may contain either strings or integers. They are of type `string' by default. To declare an integer variable x, use `typeset -i x'. Use the normal ksh syntax to reference variables: $x simple reference ${x} simple reference, explicit bounding of name ${x-val} substitute `val' if x is unset ${x:-val} substitute `val' if x is unset or is null ${x=val} assign `val' to x if x is unset ${x:=val} assign `val' to x if x is unset or null ${x+val} substitute `val' if x is set ${x:+val} substitute `val' if x is set and non-null ${x?val} generate error msg `val' if x is unset ${x:?val} generate error msg `val' if x is unset or null ${x#pat} value of x, less smallest left-matching pattern ${x##pat} value of x, less largest left-matching pattern ${x%pat} value of x, less smallest right-matching pattern ${x%%pat} value of x, less largest right-matching pattern ${#x} length of the (formatted) value of x Use `typeset -i<base> x' to declare `x' an integer variable with output base <base> (2 to 36, inclusive). Numeric values in other bases may be entered as `<base>#<digits>'. For example, the number 42 (decimal) may be entered as any of the following: 2#101010 3#1120 4#222 5#132 6#110 7#60 8#52 9#46 10#42 11#39 12#36 13#33 14#30 15#2C 16#2A 17#28 18#26 19#24 20#22 21#20 22#1K 23#1J 24#1I 25#1H 26#1G 27#1F 28#1E 29#1D 30#1C 31#1B 32#1A 33#19 34#18 35#17 36#16 Other valid forms for `42' are `052' and `0x2a' (the `C' syntax for octal and hex constants, respectively). Case is not significant in any of these forms.


language

language # Print the name of the current language used for # parsing and evaluating expressions. See also # `help dbxenv' under `language_mode'. language <lang> # Set current language to <lang>, where <lang> is either `c', `ansic', `c++', `objc', `pascal', `fortran', or `fortran90'. Note: `c' is an alias for `ansic' and `objc' is an alias for `c++'.


last_choice

This variable remembers the last choice made from an overload-resolution menu. It is useful primarily in scripts: function myprint { # print it twice, once in octal, then in hex # reuse same overload choice, if any DBX_output_base=8 builtin print $* DBX_output_base=16 builtin print $* <<-EOF $last_choice EOF }


let

let <arg>... # Evaluate one or more arithmetic expressions. The return code is 0 (true) if the last expression evaluated is non-zero, 1 (false) otherwise. `let <arg>...' is equivalent to `((<arg>...))'. See `help ksh expressions' for more information.


line

line # Display the current line number line <num> # Set the current line number line "<filename>" # Set current line number to line 1 in <filename> line "<filename>":<n> # Set current line number to line <n> in <filename> The '"' around the filename is optional. Examples: line 100 line "/root/test/test.cc":100


list

The default number of lines listed, N, is controlled by the dbxenv variable `output_list_size'. See `help dbxenv' under `output_list_size' for more information. list # List N lines list <n> # List line number <n> list + # List next N lines list +<n> # List next <n> lines list - # List previous N lines list -<n> # List previous <n> lines list <n1>,<n2> # List lines from <n1> to <n2> list <n1>,+ # List from <n1> to <n1> + N list <n1>,+<n2> # List from <n1> to <n1> + <n2> list <n1>,- # List from <n1>-N to <n1> list <n1>,-<n2> # List from <n1>-<n2> to <n1> list <function> # List the start of the source for <function> list <filename> # List the start of the file <filename> list <filename>:<n> # List file <filename> from line <n> # Where appropriate, the line number may be `$' which denotes the last line of the file. Comma is optional. `list <function>' changes the current scope. See `help scope' for more information. Options: -i or -instr # Intermix source lines and assembly code -w or -w<n> # List N (or <n>) lines (window) around line or function. This option is not allowed in combination with the '+' or '-' syntax or when two linenumbers are specified. Examples: list // list N lines starting at current line list +5 // list next 5 lines starting at current line list - // list previous N lines list -20 // list previous 20 lines list 1000 // list line 1000 list 1000,$ // list from line 1000 to last line list 2737 +24 // list line 2737 and next 24 lines list 1000 -20 // list line 980 to 1000 list "test.cc":33 // list source line 33 in file "test.cc" list -w // list N lines around current line list -w8 `test.cc`func1 // list 8 lines around function func1 list -i 500 +10 // list source and assembly code for line 500 to line 510


listi

Same as `list -i'. Please see `help list' for details.


loadobject

loadobject # Print the name of the current loadobject


loadobjects

loadobjects # List names of current loadobjects loadobjects -a # List names of all loaded loadobjects, even those not in use by the current program loadobjects -v # List text address ranges and names of current loadobjects loadobjects -a -v # List text address ranges and names of all loaded loadobjects


lwp

(Solaris 2.x) lwp # Display current LWP lwp <lwpid> # Switch to LWP <lwpid>


lwpid

(Solaris 2.3 and above) LWP ID. The syntax `l@<number>' is used and accepted by various commands to specify an LWP. The number refers to the ID of the LWP as returned by lwp_create() and furnished by the /proc interface. `all' can usually be substituted to refer to all LWPs.


lwps

(Solaris 2.x) lwps # List all LWPs in the current process


mmapfile

mmapfile <mmapped file> <address> <offset> <length> # mmap file in core dump's address space


module

module [-v] # Print the name of the current module module [-f] [-v] [-q] <name> # Read in debugging info for <name> module [-f] [-v] [-q] -a # Read in debugging info for all modules Flags: -f : Force reading of debugging info, even if the file is newer than the executable (use with caution!). -v : Verbose mode. Prints language, file names, etc. -q : Quiet mode


modules

modules [-v] # List all modules modules [-v] -debug # list all modules containing debugging info modules [-v] -read # List names of modules containing debugging info that have been read in already Flags: -v : Verbose mode. Prints language, file names, etc.


mtfeatures

If thread or LWP commands are enabled (if the target process uses MT), then `$mtfeatures' has the value `true'; otherwise it is `false'. Even if thread commands aren't available, LWP commands might be, in which case `mtfeatures' is still `true'. MT support is available only on Solaris 2.3 and later.


next

next # Step one line (step OVER calls). # With MT programs when a function call is skipped # over, all LWPs are implicitly resumed for the # duration of that function call in order to # avoid deadlock. # Non-active threads cannot be stepped. next <n> # Step <n> lines (skip OVER calls) next ... -sig <sig> # Deliver the given signal while nexting The dbxenv variable `step_events' controls whether breakpoints are enabled during a step. next ... <tid> # Step the given thread. (Solaris 2.x) next ... <lwpid> # Step the given LWP. Will not implicitly resume all LWPs when skipping a function. (Solaris 2.x) When an explicit <tid> or <lwpid> is given, the deadlock avoidance measure of the generic `next' is defeated.


nexti

nexti # Step one machine instruction (skip OVER calls) nexti <n> # Step <n> machine instructions (skip OVER calls) nexti -sig <sig> # deliver the given signal while nexting nexti ... <lwpid> # ... the given LWP. nexti ... <tid> # ... the LWP on which the given thread is active. Will not implicitly resume all LWPs when skipping a function.


objc

See `help ObjC'


objectivec

See `help ObjC'


options

# See `help invocation'.


path

By default, dbx searches your $PATH for commands. To disable $PATH search, type `set +o path'. See `help ksh options' and `help ksh PATH'.


pathmap

pathmap [ -c ] [-<index>] <from> <to> pathmap [ -c ] [-<index>] <to> # Establish a new mapping from <from> to <to> where <from> and <to> are filepath prefixes. <from> refers to the filepath compiled into the executable or objectfile and <to> refers to the filepath at debug time. If `-c' is used, the mapping is applied to the current working directory as well. If <from> is empty, all paths are mapped to <to> (the functionality of the old `use' command). If an index is specified, the mapping is inserted in the list with that index, otherwise it is added to the end of the list. pathmap # List all existing path mappings (by index) pathmap -s # The same, but the output can be read by dbx pathmap -d <from1> <from2> ... # Delete the given mapping(s) by path pathmap -d <index1> <index2> ... # Delete the given mapping(s) by index `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). `pathmap' is useful for dealing with automounted and explicit NFS mounted filesystems with different paths on differing hosts. Use `-c' when you're trying to correct problems arising due to the automounter since CWD's are inaccurate on automounted filesystems as well. The `pathmap' command is also useful if source or build trees are moved. `pathmap /tmp_mnt /' exists by default. Examples: (dbx) pathmap /export/home/work1 /net/mmm/export/home/work2 # maps /export/home/work1/abc/test.c to /net/mmm/export/home/work2/abc/test.c (dbx) pathmap /export/home/newproject # maps /export/home/work1/abc/test.c to /export/home/newproject/test.c (dbx) pathmap (1) -c /tmp_mnt / (2) /export/home/work1 /net/mmm/export/home/work2 (3) /export/home/newproject


pop

pop # Pop current topframe from stack pop <num> # Pop <num> frames from stack pop -f <num> # Pop frames from stack until specified frame number


prettyprint

If the `-p' flag is given to `print', `rprint', or `display', dbx invokes the ksh function `prettyprint', which searches for a function in the target proces s with the name `db_pretty_print' that takes three arguments: a pointer to the type of the expression, an integer, and a char *: char *db_pretty_print(const Foo *, int flags, char *formatstring); If found, dbx calls the function and prints (or displays) its return value; if not found, dbx prints (or displays) the expression itself. The dbxenv variable `output_pretty_print', if `on', causes `-p' to be passed as the default; use `+p' to override this behavior for one command. `prettyprint' is defined in the system-wide dbx startup file (see `help startup'). The value passed in the `flags' argument is bit-wise OR one of the following: FVERBOSE 0x1 not currently implemented, always set FDYNAMIC 0x2 -d FRECURSE 0x4 -r FFORMAT 0x8 -f (if set, "formatstring" is the <fmt> part) FLITERAL 0x10 -l See `help print' for the meaning of these flags.


print

print <exp>, ... # Print the value of the expression(s) <exp>, ... print -r <exp> # Print the value of the expression <exp> including its inherited members (C++ only) print +r <exp> # Don't print inherited membersression when the dbxenv `output_inherited_members' is on (C++ only) print -d [-r] <exp> # Show derived type of expression <exp> instead of static type (C++ only) print +d [-r] <exp> # Don't use derived type of expression <exp> when the dbxenv `output_dynamic_type' is on (C++ only) print -p <exp> # Call `prettyprint' function print +p <exp> # Do not call `prettyprint' when the dbxenv `output_pretty_print' is on (see `help prettyprint') print -l <exp> # (`Literal') Do not print the left side. If the expression is a string (char *), do not print the address, just print the raw characters of the string, without quotes. print -f<fmt> <exp> # Use <fmt> as the format for integers, strings, or floating-point expressions (see `help format') print -F<fmt> <exp> # Use the given format but do not print the left hand side (the variable name or expression) (see `help format') print -- <exp> # `--' signals the end of flag arguments. This is useful if <exp> may start with a plus or minus (see `help scope' for scope resolution rules. See `help redirection' to redirect the output of a `print' and add a trailing comment.)


prog

prog -readsyms # Read symbolic information which was postponed by # having set dbxenv run_quick to 'on'. prog -executable # Prints the full path of the executable, "-" if the # program was attached to using -. prog -argv # Prints the whole argv, including argv[0]. prog -args # Prints the argv, excluding argv[0]. prog -stdin # Prints "< <filename>" or empty if stdin is used. prog -stdout # Prints "> <filename>" or ">> <filename>" or empty of # stdout is used. # The outputs of -args, -stdin, -stdout are designed # so that the strings can be combined and reused # with `run'.


pwd

pwd # Print the current working directory


quit

quit # Exit dbx with return code 0. Same as `exit'. quit <n> # Exit with return code <n>. Same as `exit <n>'. If dbx was attached to a process, the process is detached from before exiting. If there are pending signals, they are cancelled. Use `detach' for fine control.


read

read <name> # Accept a line from stdin, assign it to the ksh variable <name> read <n1> <n2>... # Accept a line from stdin, assign the first word to <n1>, the second word to <n2>, etc. The last name receives all of the remainder of the line if there are more words in the input than names. read <name>?<prompt> # Print <prompt> on stderr, then accept a line from stdin and assign it to <name> read -e ... # Treat backslash at the end of a line as a line continuation character (default) read -r ... # Do not treat backslash specially read -u <n> ... # Read from file descriptor <n> rather than stdin


readonly

readonly # List all ksh variables with the `-r' attribute readonly <name>... # Set the `-r' attribute for the given variables readonly <name>=<val>... # Assign a new value and then set the `-r' attribute for the given variables. See `help typeset' for more information.


redirection

There are two classes of commands in dbx: redirectable and non-redirectable. The non-redirectable commands take language expressions or patterns as arguments. Since the I/O redirection operators are also expression operators in the languages that dbx supports, any command that takes an expression treats the I/O operators as expression operators. Examples of non-redirectable commands are: assign, bsearch, call, display, dump, examine, files, funcs, hide, print, run, rerun, search, stop, stopi, trace, tracei, undisplay, whatis, where, whereis, which. To redirect commands, you can put the I/O redirection before the command keyword: (dbx) >foo print a > b If you wish to pipe the output of a non-redirectable command, you can wrap the command in curly braces: (dbx) { print *p; } | awk '/member[0-3]/ { print }' Only dbx output may be redirected in this manner; output produced by the target process (via printf(), for example) still goes to the `stdout' of the target process: (dbx) >foo print printf("hello") causes "hello" to appear on the terminal, and the file `foo' to contain printf("hello") = 5 which is the return value of the printf() call. See the `typeset' command to find out how you can cause a ksh function to be made non-redirectable (so it can accept language expressions as arguments). Note: Non-redirectable commands also do not recognize `#' as the start of a comment. To add a comment to such a command, use `;#'. Using some dbx commands in a pipe may have undesired results. Any command that modifies the state of the target process (or modifies dbx's information concerning the state of the target process) will not behave as expected in a pipe. Commands which should not be used in pipes include: alias, attach, bsearch, call, catch, check, clear, collector, cont, dbxenv, debug, delete, detach, display, down, fix, frame, func, handler, hide, ignore, import, intercept, kill, language, next, nexti, pathmap, pop, quit, replay, rerun, restore, run, save, search, set, setenv, step, stepi, stop, stopi, suppress, trace, tracei, unalias, uncheck, undisplay, unhide, unintercept, unsuppress, up, use, when, wheni. To redirect these commands, use a temp file: (dbx) >/tmp/xxx call foo(); cat /tmp/xxx | sed 's/foo/FOO/'


registers

Register names are machine-specific. These names are reserved and may not be used as ksh environment variable names. Use the following registers names in expressions: On SPARC: $g0 $g1 ... $g7 $o0 $o1 ... $o7 $l0 $l1 ... $l7 $i0 $i1 ... $i7 $f0 $f1 ... $f31 $pc $npc $y $psr $wim $tbr $fsr $fq $fp $sp The following pairs of floating-point registers are treated as having C "double" type (normally $fN registers are treated as C "float" type): $f0f1 $f2f3 ... $f30f31 These additional registers are available on SPARC V9 and V8+ hardware: $xg0 $xg1 ... $xg7 $xo0 $xo1 ... $xo7 $xfsr $tstate $gsr $f32f33 $f34f35 ... $f62f63 On Intel: $pc $ps $fp $sp $gs $fs $es $ds $edi $esi $ebp $esp $ebx $edx $ecx $eax $trapno $err $eip $cs $eflags $uesp $ss $di $si $bp $SP $bx $dx $cx $ax $bl $bh $dl $dh $cl $ch $al $ah $ip $flags $st0 $st1 ... $st7 $fctrl $fstat $ftag $fip $fcs $fopoff $fopsel On Power-PC: $r0 $r1 ... $r31 $f0 $f1 ... $f31 $f0l $f1l ... $f31l $cr $lr $pc $msr $ctr $xer $mq $fpscr $sp To print registers as hex numbers, use one of the following: print -fx $pc print (void *)$pc x &$pc/X See also `help regs'.


regs

regs [-f] [-F] # Print value of registers # -f: include floating-point registers (single precision). # -F: Include floating-point registers (double precision) # SPARC only. Example (SPARC): dbx[13] regs -F current thread: t@1 current frame: [1] g0-g3 0x00000000 0x0011d000 0x00000000 0x00000000 g4-g7 0x00000000 0x00000000 0x00000000 0x00020c38 o0-o3 0x00000003 0x00000014 0xef7562b4 0xeffff420 o4-o7 0xef752f80 0x00000003 0xeffff3d8 0x000109b8 l0-l3 0x00000014 0x0000000a 0x0000000a 0x00010a88 l4-l7 0xeffff438 0x00000001 0x00000007 0xef74df54 i0-i3 0x00000001 0xeffff4a4 0xeffff4ac 0x00020c00 i4-i7 0x00000001 0x00000000 0xeffff440 0x000108c4 y 0x00000000 psr 0x40400086 pc 0x000109c0:main+0x4 mov 0x5, %l0 npc 0x000109c4:main+0x8 st %l0, [%fp - 0x8] f0f1 +0.00000000000000e+00 f2f3 +0.00000000000000e+00 f4f5 +0.00000000000000e+00 f6f7 +0.00000000000000e+00 ... See also `help registers'.


replay

replay [-<num>] # Replay all or all minus <num> commands since last # run/rerun/debug command. See also `help save' and # `help restore'


rerun

rerun # Begin executing the program with no arguments rerun <args> # Begin executing the program with new arguments by the save command. See also `help run'.


restore

restore [<filename>] # Restore dbx to the state it was in when it was saved. # See also `help save' and `help replay'.


return

return # Causes a ksh function to return the exit code of the last command executed return <n> # Causes a ksh function to return with exit code <n>


rprint

rprint [-r|+r|-d|+d|-p|+p|-l|-f<fmt>|-F<fmt>|--] <exp> Print the value of the expression. No special quoting rules apply, so `rprint a > b' puts the value of `a' (if it exists) into file `b' (see `help print' for flags)


rtc

Help about Runtime Checking (RTC) is organized into various subtopics. Use the command `help rtc <subtopic>' to get help on one of the subtopics. introduction # brief introduction to RTC commands # brief description of RTC related commands dbxenvs # description of RTC related dbx environment variables api # brief description of the RTC Application Programming # Interface (API) 8M # discussion and workarounds for RTC limitations # encountered in some programs attach # tips about using RTC on an attached program batch # note about batch mode for RTC mt # tips about using RTC on multi-threaded application errors # brief description of the error opcodes used by RTC


rtc 8M

This applies to SPARC only. To do access checking, dbx/RTC replaces each load and store instruction with a branch instruction that branches to a patch area. This branch instruction has an 8Mb range. This means that if the debugged program has used up all the address space within 8Mb of the particular load/store instruction being replaced, there is no place to put the patch area. If RTC can't intercept ALL loads and stores to memory it cannot provide accurate information and so disables access checking completely. Leaks checking is unaffected by this. Dbx internally applies some strategies when it runs into this limitation and continues if it can rectify this problem. In some cases dbx cannot proceed; when this happens it will turn off access checking after printing an error message. What to do if you run into this 8Mb limit: Dbx provides some possible workarounds to users who have run into this limit. These workarounds require the use of a utility called "rtc_patch_area" (documented in the man page rtc_patch_area(1)). This utility will create object files or shared object files which can be linked into the user's program and create patch areas for RTC to use. There are two typical situations that can prevent dbx from finding patch areas within 8Mb of all the loads and stores in an executable image: Case 1: The statically linked a.out file is too large. Case 2: One or more dynamically linked shared libraries is too large. When dbx runs into this limitation, it prints a message telling how much patch space it needs and directs you to the appropriate case (Case 1 or Case 2). ---------------------------------------------------------------------- In case 1, you can use rtc_patch_area to make one or more object files to serve as patch areas and link them into the a.out. Example: After you have seen a message like the following: Enabling Error Checking... dbx: warning: rtc: cannot find patch space within 8Mb (need 6490432 bytes for ./a.out) dbx: patch area too far (8Mb limitation); Access checking disabled (See `help rtc 8M', case 1) 1) Create an object file patch.o for a patch area with size <= 8Mb: rtc_patch_area -o patch.o -size 6490432 (Note: the "-size" flag is optional; the default value is 8000000.) 2) If the original size request (from the error message) is satisfied go to step (3). Otherwise repeat step (1) and create more .o files as needed. 3) Relink the a.out, adding patch .o files created in step (1) on the link line (if you have created more than one .o file in step (1), scatter them on the link line). 4) Try RTC again with the new binary. If RTC still fails the same way, you may try to reposition the patch .o files on the link line. An alternate workaround is to divide the a.out into a smaller a.out and shared libraries. ---------------------------------------------------------------------- Case 2: If you are running RTC on attached process, see case 2a first. In other cases, the only possible workaround is to rebuild the shared library with extra patch space: Example: After you have seen a message like the following: Enabling Error Checking... dbx: warning: rtc: cannot find patch space within 8Mb (need 563332 bytes for ./sh1.so) dbx: patch area too far (8Mb limitation); Access checking disabled (See `help rtc 8M', case 2) 1) Create an object file patch.o for a patch area with size <= 8Mb: rtc_patch_area -o patch.o -size 563332 (Note: the "-size" flag is optional; the default value is 8000000.) 2) If the original size request (from the error message) is satisfied go to step (3). Otherwise repeat step (1) and create more .o files as needed. 3) Relink sh1.so, adding patch .o files created in step (1) on the link line (if you have created more than one .o file in step (1), scatter them on the link line). 4) Try RTC again with the new binary; if dbx requests patch space for another shared library, repeat steps 1-3 for that library. -------------------------------------------------------------------------- Case 2a: This workaround is automatically applied by RTC in cases other than running RTC on attached process. In case 2, if the shared library patch space requested by dbx is around 8Mb or less, you can use rtc_patch_area to make a shared library to serve as a patch area and link it into the a.out. Example: After you have seen a message like the following: Enabling Error Checking... dbx: warning: rtc: cannot find patch space within 8Mb (need 563332 bytes for ./sh1.so) dbx: patch area too far (8Mb limitation); Access checking disabled (See `help rtc 8M', case 2) 1) Create a shared object patch1.so for a patch area: rtc_patch_area -so patch1.so -size 563332 (Note: the "-size" flag is optional; the default value is 8000000.) 2) Relink the program with patch1.so placed adjacent to sh1.so in the link line (first try placing it immediately after sh1.so; if dbx still requests patch space for the same sh1.so, then try placing patch1.so immediately before sh1.so). Note: It may be necessary to use full pathnames instead of the "ld" -l option to get the desired shared library ordering. 3) Try RTC again with the new binary; if dbx requests patch space for another shared library, repeat steps 1-2 for that library. If the patch space requested by dbx is more than 8Mb for a given shared library, follow the steps in case 2 above. -------------------------------------------------------------------------- The dbx team is working on a more convenient way for you to handle this situation. See `help rtc' for further help topics pertaining to RTC.


rtc api

Both leak detection and access checking require that the standard heap management routines in the shared library libc.so be used. This is so that RTC can keep track of all the allocation/deallocations in the program. Many applications write their own memory management routines either on top of malloc-free or from scratch. When you use your own allocators (referred to as "private allocators" by RTC), RTC cannot automatically track them, thus you do not get leaks and memory access errors resulting from their improper use. However, RTC provides an API for the use of "private allocators". This API allows the private allocators to get the same treatment as the standard heap allocators. The API itself is provided in a header file "rtc_api.h" and is distributed as a part of WorkShop. The man page rtc_api(3x) details the RTC API entry points. Some minor differences may exist with RTC error reporting when private allocators do not use the program heap. When memory access error referring a standard heap block occurs, RTC error report typically includes the location of the heap block allocation. This may not be reported in such cases. See `help rtc' for further help topics pertaining to RTC.


rtc attach

RTC supports following a child as well as exec() (see `help follow-fork'). RTC also works on an attached process; however the process must have librtc.so preloaded when it starts. librtc.so resides in the lib directory of the product (if the product is installed in /opt, that would be /opt/SUNWspro/lib/librtc.so). To preload librtc.so do: setenv LD_PRELOAD <...path-to-librtc...>/librtc.so (csh syntax) NOTE: It is a good idea to set preload of librtc only when needed (as with attach) and not have it on all the time. For example, setenv LD_PRELOAD ... ; start-your-application; unsetenv LD_PRELOAD In case the program you want to attach to gets forked/execed from some other program, you need to set LD_PRELOAD for the main program (which will fork). LD_PRELOAD setting gets inherited across fork/exec. See `help rtc' for further help topics pertaining to RTC.


rtc batch

Batch interface to Runtime Checking (RTC) allows the use of RTC outside the interactive mode of dbx possible. This simplifies the use of RTC in shell scripts. A separate utility called `bcheck' is provided for this purpose. `bcheck' is simply a shell script which runs the program under dbx with Runtime Checking enabled. See the man page for bcheck(1) for the details. See `help rtc' for further help topics pertaining to RTC.


rtc commands

dbx commands related to RTC fall into three categories: 1. Turning RTC on/off. This is controlled by the use of `check' and `uncheck' commands. `check' can be used to turn on memory access checking (SPARC only), memory leaks and memory use checking (see `help check' and `help uncheck') 2. Controlling the scope and the amounts of errors reported by RTC. This is controlled by the use of `suppress' and `unsuppress' commands. These commands provide a powerful means for you to control your RTC session. See `help suppress' and `help unsuppress' for details. 3. Getting memory leaks and memory use reports. Once the memory use (or leaks) checking is turned on by using `check' command, you can use `showleaks' command to get the leaks report and `showmemuse' commands to get the memory use report. You can also get details about allocation of a heap block by using `showblock' command. See `help showblock', `help showleaks' and `help showmemuse' for details. See `help rtc' for further help topics pertaining to RTC.


rtc dbxenvs

Certain behavior of RTC can be controlled by the use of dbx environment variables (see `help dbxenv'). The dbxenvs pertaining to RTC are listed: dbxenv rtc_auto_continue <on | off> Log RTC errors to rtc_error_log_file_name and continue. Default: off dbxenv rtc_auto_suppress <on | off> If on, an RTC error at a given location is reported only once. Default: on dbxenv rtc_biu_at_exit <on | off | verbose> Used when memory use checking is on (either via `check -memuse' or via `check -all'). If the value of the variable is `on', a non-verbose memory use (blocks in use) report will be produced at program exit. If the value is `verbose', a verbose memory use report will be produced at program exit. The value `off' causes no output. This variable has no effect on the interactive `showmemuse' command. See also `help check' and `help showmemuse'. Default: on dbxenv rtc_error_limit <num> Number of RTC errors that will be reported. Default: 1000 dbxenv rtc_error_log_file_name <filename> Name of file where RTC errors will be logged if `rtc_auto_continue' is set. Default: /tmp/dbx.errlog.<uniqueID> dbxenv rtc_mel_at_exit <on | off | verbose> This variable is used when leaks checking is on. If the value of the variable is `on', a non-verbose memory leak report will be produced at program exit. If the value is `verbose', a verbose memory leak report will be produced at program exit. The value `off' causes no output. This variable has no effect on the interactive`showleaks' command. Default: on See `help rtc' for further help topics pertaining to RTC.


rtc errors

Errors reported by RTC generally fall in two categories. Access errors and leaks. When access checking is turned on, RTC detects and reports the following kinds of errors: 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 With leak checking, RTC will report the following kinds of errors: 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 Memory use report uses the opcode biu (Block in use). See `help rtc' for further help topics pertaining to RTC.


rtc introduction

RTC Introduction ================ Runtime Checking (RTC) is a dbx feature that consists of two parts: memory access checking and memory use/leaks checking. Memory access checking is available only on SPARC. Access checking checks for improper use of memory by the debugged application. RTC monitors memory accesses (loads, stores, and free operations) and also detects memory leaks (allocations of malloc() [heap] space which are not freed and which have no pointers referencing them). Access checking enables you to find loads or stores to out-of-range memory (operations that might show up unpredictably as a BUS errors or segmentation violations); loads and stores using in-range memory that has been deallocated (either through a free() call, for heap memory, or through a function return, for stack memory); loads from in-range memory that has not been initialized; and improper free() calls such as duplicate free()'s or free()'s of non-malloc() space. Memory use/leak checking involves keeping track of all the outstanding heap space and then on demand or at termination of the program, scanning the available data spaces and identifying the space that has no references. See `help rtc' for further help topics pertaining to RTC.


rtc mt

Runtime Checking (RTC) supports multi-threaded applications on Solaris 2.4 and above. However to use it on Solaris 2.4 you must install the libthread patch (included with the dbx distribution), 102224 for SPARC (102225 for Intel), on all the systems where you run dbx. Along with each access checking error report (SPARC only), RTC prints the ID of the thread on which the error occurred. The leak report generated by RTC includes the leaks from all the threads in the program. See `help rtc' for further help topics pertaining to RTC.


run

run # Begin executing the program with the current arguments run <args> # Begin executing the program with new arguments Use ^C to stop executing the program. See also `help rerun', `help runargs' and `help prog'.


runargs

runargs <args> # Set the current arguments, to be used by `run' runargs ... >|>> <file> # Set the output redirection to be used by `run' runargs ... < <file> # Set the input redirection to be used by `run' runargs # Clear the current arguments Use `debug' by itself to inspect the current arguments. See also `help prog'.


save

save [-<num>] [<filename>] # Save all or all minus <num> commands since last run/rerun/debug command to default file or <filename>. See also `help restore' and `help replay'.


scope

The scope is a subset of a program defined in terms of the visibility of a variable or function. A symbol is said to be "in scope" if its name is visible at the given point of execution. In C, functions may have global or file-static scope; variables may have global, file-static, or block scope. In dbx, scope also refers to the point in the program where the search for a given symbol begins. Normally, it is the same as the current line, but several commands can change the current scope without causing the point of execution to move: func file up, down, frame list <procedure> To get the fully qualified name of a symbol, use: which <name> To find all declarations of a name, use: whereis <name> You can also use backquotes to give the scope of a name explicitly: print `file.c`func1`x print `file.c`func2:212`y # "y" is declared in block at line 212 stop in `libxx.so.1`func3 # func3 is declared in dyn. library xx stop in `file.c`func1 stop in `file.c`classname::func2 stop in ``func3 # "func3" is extern or file static stop in `func4 # "func4" is extern stop in #fun # "fun" is a linker symbol; dbx looks it up in global scope exactly as it appears stop in `file.c`#fun # to search in file.c static scope for linker name "fun" To relax the scope lookup rules for static symbols and C++ member functions, use: dbxenv scope_look_aside on or use the "double backquote" prefix: stop in ``func4 # "func4" may be static and not in scope If scope_look_aside is turned on, dbx looks for: - Static variables defined in other files if not found in current scope. Files from libraries in /usr/lib are not searched. - C++ member functions without class qualification - Instantiations of C++ inline member functions in other files if a member function is not instantiated in current file.


scopes

scopes # Print list of active scopes, including namespaces


search

search <string> # Search forward for <string> in the current file search # Repeat search, using last search string


set

set # Lists all ksh variables and their values set <arg>... # Sets the positional parameters to <arg>... set -- <arg>... # Sets the positional parameters, even if <arg> starts with a dash set -o <opt> # Sets option <opt> set +o <opt> # Clears option <opt> set -o # Lists all currently set options set +o # Lists all currently set options set -<opt> # Sets the option with abbreviation <opt> set +<opt> # Clears the option with abbreviation <opt>. See `help ksh options' for more information.


setenv

setenv <name> <string> # Set environment variable <name> to <string>


sh

sh <cmd> [<arg>...] # Execute <cmd>, suppressing the usual search of aliases, functions, and builtins.


shift

shift # Shift the positional parameters one position to the left, dropping $1 shift <n> # Shift the positional parameters <n> positions to the left, dropping the first <n> arguments


showblock

showblock -a <addr> When memory use checking or memory leak checking is turned on, showblock shows the details about the heap block at address <addr>. The details include the location of the blocks' allocation and its size. (see `help check')


showleaks

showleaks [-a] [-m <m>] [-n <num>] [-v] Report new memory leaks since the last `showleaks' command. In the default non-verbose case, a one line report per "leak" record is printed. "Actual leaks" are reported followed by the "possible leaks". Reports are sorted according to the combined size of the leaks. -a Show all the leaks generated so far (not just the leaks since the last `showleaks' command). -m <m> Used for combining leaks; if the call stack at the time of allocation for two or more leaks matches <m> frames, then these leaks are reported in a single combined leak report. If the -m option is given, it overrides the global value of <m> (specified with the `check' command). The default value of <m> is 2 or (if specified) the global value last given with the check command. -n <num> Show up to <num> records in the report. Default is to show all records. -v Generate verbose output. Default is to show non-verbose output. See `help check'.


showmemuse

showmemuse [-a] [-m <m>] [-n <num>] [-v] showmemuse shows the memory blocks in use since the last `showmemuse' command. A one line report per "block in use" record is printed. It sorts the reports according to the combined size of the blocks. Any leaked blocks since the last `showleaks' command are also included in the report. -a Show all the blocks in use (not just the blocks since the last showmemuse command). -m <m> Used for combining the blocks in use reports. If the call stack at the time of allocation for two or more blocks matches <m> frames then these blocks are reported in a single combined report. If the -m option is given, it overrides the global value of <m>. -n <num> Show up to <num> records in the report. Default is 20. -v Generate verbose output. Default is to show non-verbose output. The default value of <m> is 2 or (if specified) the global value last given with the `check' command. The default value of <num> option is 20. See `help check'.


signals

SIGHUP 1 # hangup SIGINT 2 # interrupt (rubout) SIGQUIT 3 # quit (ASCII FS) SIGILL 4 # illegal instruction (not reset when caught) ILL_ILLOPC 1 # illegal opcode ILL_ILLOPN 2 # illegal operand ILL_ILLADR 3 # illegal addressing mode ILL_ILLTRP 4 # illegal trap ILL_PRVOPC 5 # privileged opcode ILL_PRVREG 6 # privileged register ILL_COPROC 7 # co-processor ILL_BADSTK 8 # bad stack SIGTRAP 5 # trace trap (not reset when caught) SIGIOT 6 # IOT instruction SIGABRT 6 # used by abort, replace SIGIOT in the future SIGEMT 7 # EMT instruction EMT_TAGOVF 1 # tag overflow SIGFPE 8 # floating-point exception FPE_INTDIV 1 # integer divide by zero FPE_INTOVF 2 # integer overflow FPE_FLTDIV 3 # floating-point divide by zero FPE_FLTOVF 4 # floating-point overflow FPE_FLTUND 5 # floating-point underflow FPE_FLTRES 6 # floating-point inexact result FPE_FLTINV 7 # invalid floating-point operation FPE_FLTSUB 8 # subscript out of range SIGKILL 9 # kill (cannot be caught or ignored) SIGBUS 10 # bus error BUS_ADRALN 1 # invalid address alignment BUS_ADRERR 2 # non-existent physical address BUS_OBJERR 3 # object specific hardware error SIGSEGV 11 # segmentation violation SEGV_MAPERR 1 # address not mapped to object SEGV_ACCERR 2 # invalid permissions SIGSYS 12 # bad argument to system call SIGPIPE 13 # write on a pipe with no one to read it SIGALRM 14 # alarm clock SIGTERM 15 # software termination signal from kill SIGUSR1 16 # user defined signal 1 SIGUSR2 17 # user defined signal 2 SIGCLD 18 # child status change SIGCHLD 18 # child status change alias (POSIX) SIGPWR 19 # power-fail restart SIGWINCH 20 # window size change SIGURG 21 # urgent socket condition SIGPOLL 22 # pollable event occurred SIGIO 22 # socket I/O possible (SIGPOLL alias) SIGSTOP 23 # stop (cannot be caught or ignored) SIGTSTP 24 # user stop requested from tty SIGCONT 25 # stopped process has been continued SIGTTIN 26 # background tty read attempted SIGTTOU 27 # background tty write attempted SIGVTALRM 28 # virtual timer expired SIGPROF 29 # profiling timer expired SIGXCPU 30 # exceeded cpu limit SIGXFSZ 31 # exceeded file size limit SIGWAITING 32 # process's lwps are blocked (Solaris 2.x) SIGLWP 33 # special signal used by thread library (Solaris 2.x) SIGFREEZE 34 # special CPR signal (Solaris 2.x) SIGTHAW 33 # special CPR signal (Solaris 2.x)


source

source <filename> # Execute commands from file <filename>. $PATH is not searched. See also `help .'.


startup

First, if no `-S' flag was given, and if the file <install-directory>/lib/dbxrc exists and is readable, dbx reads it. (The path to the site-specific initialization file is derived from the path to the dbx executable.) dbx searches for the file `.dbxrc' in the current directory, then in $HOME. If the file is not found, dbx searches for `.dbxinit' in the current directory, then in $HOME. A different startup file may be given explicitly via the `-s' command-line option. See `help .dbxrc' for a sample .dbxrc file. A startup file may contain any dbx command. Most commonly, it contains alias and function definitions. It may also `source' other files using the `source' or `.' command (see `help source' and `help .'). The startup file is also a good place to set various options via `set -o' and `dbxenv'. If you have no startup file, or if you have `.dbxrc' in the current directory or in $HOME, then the `alias' command is aliased to `kalias'. If you have a `.dbxinit' file in the current directory or in $HOME and no `.dbxrc' file, then `alias' is aliased to `dalias'. This is done to provide backward compatibility for users of previous versions of dbx. You may use your old `.dbxinit' file without changes by adding the following three lines to your `.dbxrc' file: kalias alias=dalias source ~/.dbxinit kalias alias=kalias


status

status # Print trace's, when's, and stop's in effect status <hid> # Print status for handler <hid> status -h # Print trace's, when's, and stop's in effect including # the hidden ones. status -s # The same, but the output can be read by dbx (dbx) status -s > bpts ... (dbx) source bpts See also the `-r' flag of the `debug' command.


step

step # Single step one line (step INTO calls). # With MT programs when a function call is skipped # over, all LWPs are implicitly resumed for the # duration of that function call in order to # avoid deadlock. # Non-active threads cannot be stepped. step <n> # Single step <n> lines (step INTO calls) step up # ... and out of the current function step ... -sig <sig> # ... and deliver the given signal The dbxenv variable `step_events' controls whether breakpoints are enabled during a step. step ... <tid> # Step the given thread. Does not apply to `step up'. (Solaris 2.x) step ... <lwpid> # Step the given LWP. Will not implicitly resume all LWPs when skipping a function. (Solaris 2.x) When an explicit <tid> or <lwpid> is given, the deadlock avoidance measure of the generic `step' is defeated.


stepi

stepi # Single step one machine instruction (step INTO calls) stepi <n> # Single step <n> machine instructions (step INTO calls) stepi -sig <sig> # ... and deliver the given signal stepi ... <lwpid> # ... the given LWP. stepi ... <tid> # ... the LWP on which the given thread is active.


stop

stop [ -update ] # Stop execution now. Only valid within the body of a WHEN. stop -noupdate # Same as -update, but does not update GUI displays. stop at <line> # Stop execution at the line stop in <func> # Stop execution when <func> is called stop inclass <clsname> # C++ only: set breakpoints on all member functions of a class/struct/union or template class stop inmember <name> # C++ only: set breakpoints on all member functions <name> stop infunction <name> # C++ only: set breakpoints on all non-member functions <name> `stop' has a general syntax as follows: stop <event-specification> [ <modifier> ] When the specified event occurs, the process is stopped. For a list and the syntax of all events see `help event specification'. For a general discussion of event management commands see `help events'.


stopi

stopi at <addr> # Stop execution at location <addr> stopi in <func> # Stop execution when <func> is called. stopi is similar to `stop' except that when the program stops due to a stopi dbx shows the location in disassembly. `stopi' has a general syntax as follows: stopi <event-specification> [ <modifier> ] When the specified event occurs, the process is stopped. For a list and the syntax of all events see `help event specification'. For a general discussion of event management commands see `help events'.


suppress

suppress # History of suppress and unsuppress commands # (not including "-d" and "-reset" commands) suppress -d # List of errors being suppressed in functions # not compiled for debugging (default # suppression). This list is per loadobject. # These errors can be unsuppressed only # by using the `unsuppress -d' command. suppress -d <errors> # Modify the default suppressions for all # loadobjects by further suppressing <errors> suppress -d <errors> in <loadobjects> # Modify the default suppressions in the # <loadobjects> by further suppressing # <errors> suppress -last # At error location suppress present error suppress -reset # Set the default suppression to the # original value (startup time) suppress -r <id> ... # Remove the (un)suppress events as given # by the id(s) (id(s) can be obtained by # doing `(un)suppress'. suppress -r 0 | all | -all # Remove all the (un)suppress events as given # by `(un)suppress'. suppress <errors> # Suppress <errors> everywhere suppress <errors> in [<funcs>] [<files>] [<loadobjects>] # Suppress <errors> in list of <funcs> and list # of <loadobjects> suppress <errors> at <line> # Suppress <errors> at <line> suppress <errors> at "<file>":<line> # Suppress <errors> at <line> in <file> suppress <errors> addr <addr> # Suppress <errors> at location <addr> The <errors> are blank separated and can be any combination of: all # All errors aib # Possible memory leak - address in block air # Possible memory leak - address in register baf # Bad free duf # Duplicate free mel # Memory leak 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 biu # Block in use (allocated memory). Though not an error, you # can use `biu' just like <errors> in the suppress commands. Also note the "rtc_auto_suppress" variable: dbxenv rtc_auto_suppress <on | off> # If on, RTC error at a given location is reported only once. See `help unsuppress' for information on unsuppressing errors. See `help rtc' for an introduction to RTC.


test

test <expr> # Returns true (0) if <expr> evaluates to true, false (1) otherwise. The following operators are recognized: -r <file> <file> is readable -w <file> <file> is writable -x <file> <file> is executable (searchable, if <file> is a directory) -f <file> <file> is a regular file -d <file> <file> is a directory -c <file> <file> is a character special file -b <file> <file> is a block special file -p <file> <file> is a named pipe (FIFO) -u <file> <file> has its set-uid-bit set -g <file> <file> has its set-gid-bit set -k <file> <file> has its sticky bit set -s <file> <file> is greater than 0 bytes -O <file> <file> is owned by this user -G <file> <file> has same group ID as this user -L <file> <file> is a symbolic link -S <file> <file> is a socket special file -t <fd> <fd> is an open file descriptor which is associated with a tty -z <string> <string> is zero length -n <string> <string> is non-zero length -o <opt> option <opt> is set ! negates following expression -o binary `or' -a binary `and' (<expr>) grouping (must be quoted) Note: The `-o' operator is taken to mean `option' only if the word following it is one of the options accepted by the `set' command. See `help ksh options' for the list.


thread

(Solaris 2.3 and above) thread # Display current thread thread <tid> # Switch to thread <tid>. In the following variations, a missing <tid> implies the current thread. thread -info [ <tid> ] # Print everything known about the given thread thread -hide [ <tid> ] # "hide" the given (or current) thread. It will not show up in the generic `threads' listing. thread -unhide [ <tid> ] # "unhide" the given (or current) thread. thread -unhide all # "unhide" all threads. thread -suspend <tid> # Keep the given thread from ever running. A suspended # thread shows up with an 'S' in the threads list. thread -resume <tid> # Undo the effect of "-suspend".


threads

(Solaris 2.3 and above) threads # Print the list of all known threads threads -all # Print threads normally not printed (zombies) threads -mode all|filter # Controls whether `threads' prints all threads or filters them by default. threads -mode auto|manual # Under the GUI, enables automatic updating of the thread listing. threads -mode # Echo the current modes


tid

(Solaris 2.x) Thread ID. The syntax `t@<number>' is used and accepted by various commands to specify a thread. The number refers to the ID of the thread as returned by thr_create(). `all' can usually be substituted to refer to all threads.


times

times # Prints the accumulated user and system times for dbx and for all of its child processes


trace

trace step # Trace each source line trace next -in <func> # Trace each source line while in the given function trace at <line#> # Trace given source line trace in <func> # Trace calls to and returns from the given function trace inmember <func> # Trace calls to any member function named <func> trace infunction <func> # Trace when any function named <func> is called trace inclass <class> # Trace calls to any member function of <class> trace change <var> # Trace changes to the variable ... `trace' has a general syntax as follows: trace <event-specification> [ <modifier> ] When the specified event occurs, a "trace" is printed. For a list and the syntax of all events see `help event specification'. For a general discussion of event management commands see `help events'. The speed of a trace is set using the dbxenv variable trace_speed. For backward compatibility, the following syntactical variations of trace eventspecs are accepted, although they are considered anachronistic and will be eliminated in future releases. trace # Trace each source line trace in <proc> # Trace each source line while in proc trace <line#> # Trace given source line trace <proc> # Trace calls to the procedure trace <exp> at <line#> # Print <exp> when <line> is reached trace <var> [in <proc>] # Trace changes to the variable


tracei

tracei step # Trace each source line tracei next -in <func> # Trace each source line while in the given function tracei at <address> # Trace given source line tracei in <func> # Trace calls to and returns from the given function tracei inmember <func> # Trace calls to any member function named <func> tracei infunction <func># Trace when any function named <func> is called tracei inclass <class> # Trace calls to any member function of <class> tracei change <var> # Trace changes to the variable ... tracei is really a shorthand for `trace <event-specification> -instr' where the -instr modifier causes tracing to happen at instruction granularity instead of source line granularity. See `help trace' for more information. For backward compatibility, the following syntactical variations of trace eventspecs are accepted, although they are considered anachronistic and will be eliminated in future releases. tracei # Trace each instruction tracei <var> # Trace changes to <var>. Uses automatic `stepi' tracei <var> at <addr> # Trace value of <var> at <addr>


trap

trap # Displays currently set traps and actions trap <action> <cond>... # Causes dbx to execute <action> whenever any <cond> occurs. The possible values for <action> are: null ignore the condition - reset the handling to the default omitted same as `-' <cmd> execute the command when the condition is triggered Valid values for the <cond> are: 0 occurs when dbx exits <n> a signal number <name> a signal name; `kill -l' lists the valid names EXIT same as 0


true

true # Does nothing and returns zero


typeset

typeset # Displays the names of all ksh variables and their attributes typeset -f # Displays the names of all ksh functions typeset -x # Same as `export' (which see) typeset -r # Same as `readonly' (which see) typeset -i # Displays the names and values of all ksh variables with the `-i' (integer) attribute typeset -t # Displays the names and values of all ksh variables with the `-t' (traced) attribute typeset -q # Displays the names of all ksh functions with the `-q' (quote) attribute typeset -[xritq] <name> # Sets the attribute for the named variable or function typeset +[xritq] <name> # Clears the attribute typeset -i<n> <var> # Sets the integer attribute and the output base for variable <var>. <n> must be from 2 to 36, inclusive.


ulimit

ulimit # Displays the current file size limit (same as `-f') ulimit -[f] # Displays the current hard limit for the following: -f size of file written (blocks) ulimit -[f] <n> # Sets the hard limit (must be super user to raise a hard limit)


umask

umask # Displays the current umask as a three-digit octal number umask <n> # Sets the umask to the given value (interpreted as an octal number). The umask specifies the bits which will be set to zero in the file permissions of any file created by this process. Typical values are 022 (not writable by the group or the world), and 027 (not writable by the group, no access for the world).


unalias

unalias <name>... # Remove the alias definition of the given names, if any.


unbutton

unbutton <cmd> # Remove all GUI buttons containing <cmd> unbutton -a # Remove all GUI buttons This command is silently ignored unless dbx is running under control of the GUI.


uncheck

uncheck # print current status of checking uncheck -access # turn off access checking uncheck -leaks # turn off leak checking uncheck -memuse # turn off memuse checking (leak checking # is turned off as well) uncheck -all # equivalent to `uncheck -access; uncheck # -memuse' uncheck [<funcs>] [<files>] [<loadobjects>] # equivalent to `suppress all in # <funcs> <files> <loadobjects>;' See `help check' for information to turn on checking See `help suppress' for information on suppressing of errors See `help rtc' for an introduction to RTC.


undisplay

undisplay <exp>, ... # Undo a `display <exp>' command undisplay <n>, ... # Undo the `display' commands numbered <n>... undisplay 0 # Undo all `display' commands


unhide

unhide 0 # Delete all stack frame filters unhide <regexp> # Delete stack frame filter <regexp> unhide <num> # Delete stack frame filter number <num> The `hide' command lists the filters with numbers.


unintercept

unintercept <typename> # Delete <typename> from `intercept' list unintercept -a # Delete all types from `intercept' list unintercept -x <typename> # Delete <typename> from `intercept -x' list unintercept -x -a # Delete all types from `intercept -x' list unintercept # List intercepted types See also `help intercept'


unset

unset <var>... # Remove the definition of the given ksh variables, if any. unset -f <func>... # Remove the definition of the given ksh functions, if any.


unsuppress

unsuppress # History of suppress/unsuppress commands # (not including "-d" and "-reset" commands) unsuppress -d # List of errors being unsuppressed in functions # that are not compiled for debugging. This # list is per loadobject. Any other errors can # be suppressed only by using the `suppress -d' # command. unsuppress -d <errors> # Modify the default suppressions for all # loadobjects by further unsuppressing <errors> unsuppress -d <errors> in <loadobjects> # Modify the default suppressions in the # <loadobjects> by further unsuppressing # <errors> unsuppress -last # At error location unsuppress present error unsuppress -reset # Set the default suppression mask to the # original value (startup time) unsuppress <errors> # Unsuppress <errors> everywhere unsuppress <errors> in [<funcs>] [<files>] [<loadobjects>] # Suppress <errors> in list of <funcs> and list # of <loadobjects> unsuppress <errors> at <line> # Unsuppress <errors> at <line> unsuppress <errors> at "<file>":<line> # Unsuppress <errors> at <line> in <file> unsuppress <errors> addr <addr> # Unsuppress <errors> at location <addr> The <errors> are blank separated and can be any combination of: all # All errors aib # Possible memory leak - address in block air # Possible memory leak - address in register baf # Bad free duf # Duplicate free mel # Memory leak 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 biu # Block in use (allocated memory). Though not an error, you # can use `biu' just like <errors> in the unsuppress commands. See `help suppress' for information on suppressing errors. See `help rtc' for an introduction to RTC.


up

up # Move up the call stack one level up <number> # Move up the call stack <number> levels up -h [<number>] # Move up the call stack, but don't skip hidden frames


use

This command is an anachronism and usage of this command is mapped to the following `pathmap' commands: `use' => `pathmap -s' `use <dir>' => `pathmap <dir>' See `help pathmap' for more details. The `use' command will not be accepted in future releases.


version

This predefined read-only variable contains the current dbx version string.


vitem

vitem -new <array-expr> # create new visualization item vitem <id> -replace <array-expr># replace an existing item vitem <id>|all ... -update ontimer|onstop|ondemand # set the update mode for the given item vitem <id>|all ... -update now # refresh all 'ondemand' items vitem <id>|all ... -enable # enable refreshes if given item vitem <id>|all ... -disable # disable refreshes if given item vitem <id>|all -list # list all know items vitem <id>|all -list -s # list all know items in a way that they # can be re-read using the 'source' cmd. vitem <id>|all -delete # delete the given item vitem -timer <seconds> # set the interval timer. # dbxs single interval timer is also shared by # the 'timer' 'event specification' and the # collector command. Using one of these features # will exclude the others.


wait

wait # Wait for the current background job to terminate wait <job> # Wait for the specified background job to terminate. See `help fg' for the valid syntax for <job>. The `%' is optional.


watch

(Solaris 2.x) See `help event modify'


watchpoint

(Solaris 2.x) See `help event modify'


whatis

whatis [-n] [-r] <name> # Print the declaration of the non-type <name> whatis -t [-r] <type> # Print the declaration of the type <type> whatis -e [-r] [-d] <exp> # Print the type of the expression <exp> -r : Print information about base classes (C++ only) -d : Show derived type instead of static type (C++ only)


when

when at <line> { cmd; } # Execute command(s) when <line> reached when in <proc> { cmd; } # Execute command(s) when <proc> called `when' has a general syntax as follows: when <event-specification> [ <modifier> ] { <cmd> ... ; } When the specified event occurs, the <cmd>s are executed. For a list and the syntax of all events see `help event specification'. For a general discussion of event management commands see `help events'.


whence

whence <name>... # Displays the meaning of the given names. If the name is a keyword or ksh function, displays just the name. If the name is a builtin command, displays `builtin' and the command name. If the name is an alias, displays the definition of the alias. If the name is a tracked alias or UNIX command, displays the full pathname to the command. whence -v <name>... # Verbose display. For functions, includes the definition.


wheni

wheni at <addr> { cmd; } # Execute command(s) when <address> reached `wheni' has a general syntax as follows: wheni <event-specification> [ <modifier> ] { <cmd> ... ; } When the specified event occurs, the <cmd>s are executed. For a list and the syntax of all events see `help event specification'. For a general discussion of event management commands see `help events'.


where

where # Print a procedure traceback where <num> # Print the <num> top frames in the traceback where -f <num> # Start traceback from frame <num> where -h # Include hidden frames where -q # Quick traceback (only function names) where -v # Verbose traceback (include function args and line info) Any of the above forms may be followed by a thread or LWP ID to obtain the traceback for the specified entity.


whereami

whereami # Display the source line corresponding to the current location (top of the stack), and the source line corresponding to the current frame, if different. whereami -instr # Same as above, except that the current disassembled instruction is printed instead of the source line.


whereis

whereis <name> # Print all declarations of <name> whereis -a <address> # Print location of an address expression


which

which <name> # Print full qualification of <name>


whocatches

whocatches <type> # Tell where (if at all) an exception of type <type> would be caught if thrown at the current point of execution. Assume the next statement to be executed is a `throw x' where x is of type <type>, and display the line number, function name, and frame number of the `catch' clause which would catch it.