Quiz Entry - updated: 2026.07.06
How do you use GDB to set breakpoints and examine state at specific points during bomb lab analysis?
Set breakpoints at the function and at the failure path, run with your input, then at each stop inspect disas, info registers, and the stack with x/.
Essential bomb lab setup:
(gdb) break explode_bomb
(gdb) break phase_2
(gdb) run
> 33 33 41 45 57 65
At a breakpoint, gather information:
# Where am I?
(gdb) disas
# What are the register values?
(gdb) info registers
# What's on the stack?
(gdb) x/8xg $rsp
# What's a specific value?
(gdb) p/x $eax
(gdb) p/d $edi
Step through and watch values change:
(gdb) ni
(gdb) p $eax
(gdb) ni
(gdb) p $eax
Conditional breakpoints:
# Only stop when eax == 7
(gdb) break *0x401021 if $eax == 7
Watchpoints (break when memory changes):
# Break when value at address changes
(gdb) watch *0x6042e0
Tip: Use define to create shortcuts:
(gdb) define regs
> info registers rax rbx rcx rdx rdi rsi
> end
(gdb) regs
Go deeper: