GDB Refcard
GDB Refcard
GDB Refcard
GDB Version 4
Essential Commands
b [le:]function
Starting GDB
gdb
gdb
gdb
program
program core
gdb --help
Stopping GDB
quit
INTERRUPT
Getting Help
help
help
class
help command
kill
tty dev
set args arglist
set args
show args
show environment
show env var
set env var string
unset env var
run
Shell Commands
cd dir
pwd
make : : :
shell cmd
[ ]
break [le:]line
clear
delete
delete
delete
delete
clear [le:]fun
clear [le:]line
delete [n]
disable [n]
enable [n]
run
run
:::
Permissions on back
n count
commands n
[silent]
command-list
end
Program Stack
backtrace [n]
bt [n]
frame [n]
up n
down
info
info
info
info
info
info
frame [addr]
args
locals
reg [rn]: : :
all-reg [rn]
catch
breakpoints
breakpoints
breakpoints
breakpoints
at next instruction
at entry to fun()
on source line
[or breakpoint n]
Execution Control
continue [count]
step [count]
c [count]
s [count]
stepi [count]
si [count]
next [count]
n [count]
nexti [count]
ni [count]
until [location]
finish
return [expr]
signal num
jump line
jump *address
set var=expr
Display
call [/f ]
expr
x [/Nuf ] expr
N
u
f
disassem [addr]
Automatic Display
display [/f ]
display
undisplay
expr
disable disp n
enable disp n
info display
Expressions
expr
$
$n
$$
$$n
$
$
$var
addr @len
le::nm
type addr
f g
Symbol Table
info address
ptype [expr]
ptype type
GDB Scripts
source
script
cmd
command-list
define
end
document
end
cmd
help-text
Signals
handle signal
print
noprint
stop
nostop
pass
nopass
info signals
act
Debugging Targets
target type param
help target
attach param
detach
Controlling GDB
set param value
show param
o/on
h file
h size
h save
lename
size
o/on
print : : :
p :::
p address on/o
p array o/on
p demangl on/o
p
p
p
p
p
p
show commands
show commands n
show commands +
Working Files
file [le]
core [le]
exec [le]
symbol [le]
load le
add-sym le addr
info files
path dirs
show path
info share
Source Files
dir
names
dir
show dir
list
list list lines
le:]num
le:]function
+o
-o
*address
list f,l
info line num
[
info source
info sources
forw regex
rev regex
M-x
C-h
M-s
M-n
M-i
C-c
M-c
M-u
M-d
C-x
C-x
gdb
m
C-f
&
SPC
GDB License
show copying
show warranty