GDB Vs DBX
GDB Vs DBX
Invocation
gdb -s file -
(read symbols from file)
Exiting
quit exit
Ctrl-d
Logging
Commands (general)
Abbreviation - automatic (can use 's' instead of Need to use ksh 'alias' command to define aliases
'step')
Command repeat with Ret Command repeat with '!' and UpArrow Ret
Built-in help
Macro support (-g3) Macro support (-g3); Sun Studio compilers don't
generate debug info for macros, though.
Starting a program
run [arguments][ < input_file] [ > output_file run [arguments][ < input_file] [ > output_file]
start -
(run and stop in “main”) Note: only available in GUI mode when used from
Sun Studio IDE
Program environment
cd directory cd directory
gdb dbx
pwd pwd
Attaching
detach detach
- detach -stop
- syncs
(list all synchronization objects).
Note: available on Solaris only.
- lwps
- lwp lwpid
- OpenMP support.
info forks -
fork fork-id
detach fork fork-id
delete fork fork-id
Process snapshots
checkpoint -
info checkpoints Note: dbx has different mechanism for that; see
restart checkpoint-id “help save/restore/replace” commands for more
delete checkpoint checkpoint-id information.
Breakpoints
break filename:function -
break -
(stop on next instruction in current stack frame) Note: Can use “stopi at $npc”, but on sparc only
gdb dbx
condition bnum -
(removes condition)
- stop sync
- stop syncrtld
rwatch <expr> -
awatch <expr>
Note: need to re-enable manually, doen't work on
Solaris and Linux.
catch thread_join -
hbreak args -
thbreak args
rbreak regex -
gdb dbx
clear clear
clear linenum clear linenum
clear filename:linenum clear filename:linenum
clear function -
clear filename:function
Pending breakpoints -
Note: you can load shared library with “loadobject
-load lib” and set breakpoints after that or run your
program once without any breakpoints so that dbx
become aware of all libraries.
- trace next
trace at lineno
trace in func
trace modify addr-expr [ , byte-size-expr ]
trace ...
- step to [func]
until [location] -
(Execute until the program reaches a source line
greater than the current or specified location).
Signals
handle signal print when sig signal { print $signal; print $sigstr; }
trace sig signal
backtrace [-n] -
bt [-n]
- hide [ regular_expression ]
unhide [ number | regular_expression ]
unhide
(hide stack frames in “where” command output)
up [n] up [n]
down [n] down [n]
frame where 1
info frame -
list list
list \*address -
- dis -a [addr]
(disassemble entire function)
- list -i [linespec]
gdb dbx
Examining Data
print /f -
display display
- watch
(same as display, but expression is re-parsed at eac
h stopping point)
info vector -
info udot -
info auxv -
gdb dbx
- check -access
- check -memuse
- check -leaks
C Preprocessor Macros
macro list -
info variables -
(All global and static variable names, or those mat
ching REGEXP)
Altering execution
return pop
return expression -
set unwindonsignal -
Note: equivalent to off
- fix
Miscellaneous
There's similar table in built-in dbx help. Use “help FAQ” and navigate to seciton A.1.