GDB old - Opty-Forks/SSof GitHub Wiki
GDB Basics
Below is a simple list of basic GDB commands. They should get you going for most of our exercises
gdb ./file
--- open GDB to debugfile
disas function
--- disassemble functionfunction
disas address
--- disassemble function at thisaddress
b address
--- inserts a breakpoint at addressaddress
r < file
--- run the program with inputfile
s
--- execute next step of programc
--- execute until the next breakpoint of the programp expr
--- prints the valueexpr
.expr
can be a var, the pointer to a var (its address), a register, etc. It can even beaddress1 - address2
and in this case returns the difference between the addresses.info f
--- returns the info of a frame. Particularly usefull whenever you need to know where the return address of the function is stored and/or the value contained there.stack n
--- show then
registers after the stack pointerx/nx $rsp
--- show then
registers after the register$rsp
x/nx address
--- show then
registers after the addressaddress