Skip to content

Instantly share code, notes, and snippets.

@elmotec
Last active March 8, 2026 19:34
Show Gist options
  • Select an option

  • Save elmotec/8d632348ab969eb7a8b726ad21a73643 to your computer and use it in GitHub Desktop.

Select an option

Save elmotec/8d632348ab969eb7a8b726ad21a73643 to your computer and use it in GitHub Desktop.
dbx cheat sheet

Start & Attach

dbx ./a.out
dbx ./a.out core
dbx - core
dbx -p <pid>

Substitute path

pathmap <build dir> <src dir>
pathmap -d /path
pathmap

Faster startup

Faster startup (no symbols initially):

dbx -r blah.tsk arg1 arg2
(dbx) loadobject -load -all

Exclude a library:

(dbx) loadobject -exclude libX.so

Speed up symbol loading (shared object debugging):

strip _task_name_

Inside dbx:

run [args]
rerun
attach <pid>
detach
quit

Breakpoints

stop at file.c:42
stop in function_name
stop in class::method
stop in function if x == 10

C++ Specific:

stop in Class::Class
stop in Class::~Class
stop in 'Class<int>::method'
stop throw

Manage breakpoints:

status
delete <n>
disable <n>
enable <n>

Trace (no stop):

trace in function_name
trace at file.c:42

Watchpoints:

stop access var
stop change var
stop access w &var, 4

Reference: https://docs.oracle.com/cd/E37838_01/html/E61063/gkkql.html

Execution Control

run
cont
next        # step over
step        # step into
step up     # finish current function
nexti       # instruction step over
stepi       # instruction step into
where       # backtrace

Conditional Execution

when

when at 100 { assign y = 5; cont at 102; }
when in function { assign y = 5; cont at 102; }

Skip Code

assign y = 5
cont at 102

Exception Handling

intercept -all
intercept -x ExceptionType
intercept -set

Calling Functions

call foo(15)
call foo(3.14)

For templates:

whatis foo
whatis -t foo
stop in foo<double>

Stack navigation:

up
down
frame <n>

Reference: https://docs.oracle.com/cd/E37838_01/html/E61063/gkkom.html

Inspecting Data

print var
print *ptr
print var.member

Auto-display:

display var
undisplay <n>

Memory examine:

examine var
x &var
x/16bx &buffer

Type info:

whatis var
whatis type_name

Reference: https://docs.oracle.com/cd/E37838_01/html/E61063/gkkog.html

Source & Disassembly

file <file_name>
list
list 40,60
list function_name

Disassemble:

dis
dis function_name
listi

Threads

Threads & LWPs
threads
thread
thread <id>
lwps
lwp
lwp <id>

Reference: https://docs.oracle.com/cd/E37838_01/html/E61063/gkkqj.html

Signals

catch SIGSEGV
ignore SIGPIPE
signal

Reference: https://docs.oracle.com/cd/E37838_01/html/E61063/gkkpz.html

Core Files

dbx ./a.out core
where
print var

Switch context:

debug ./a.out
core corefile

Runtime Checking

check -all
check -access
check -leaks
showleaks
showmemuse

Reference: https://docs.oracle.com/cd/E37838_01/html/E61063/gkkqu.html

Configuration & Utilities

help
help <command>
set $disasm = on
setenv VAR value
shell ls
call function(args)
source .dbxrc
gdb off|on

Initialization file:

~/.dbxrc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment