gdb commands

Categories CTF, Development

This is a list of handy gdb commands for reference:

1. Breakpoints

b *[addr]: Set break points

i b: list all breakpoints

save breakpoints [filename]: save breakpoints to file

source [filename]: read breakpoints from file

2. dump memory

x/[length]x [addr]|$register:  dump memory from lower location to higher location  at [addr] or pointed by $register(e.g $ESP).

disas function/[addr]:  disassemble function or address

info proc mappings : display memory mappings

display expression: display expression result at stop

display /32xw $esp



3. Stack analysis

bt : backtrack the whole stack

4. Other

gdb attach $(pidof -x name-of-program): attach to program by pid

generate-core-file : generate core dump


set follow-fork-mode child|parent

No Comments

Leave a Reply