Skip to content

pwndbg breakpoints and run control

pwndbg uses GDB’s execution controls. A breakpoint stops execution before the selected instruction or source line; inspect the machine state at that point, then continue or step.

break main # break at a function
break vulnerable # break at a known function
break *0x401234 # break at an address
break *main+36 # break at an offset
tbreak *main+36 # one-shot breakpoint
info breakpoints
disable 2
enable 2
delete 2
Command What it does
break LOCATION Adds a breakpoint at a function, source line, or address.
break *ADDRESS Uses an instruction address rather than a source location.
tbreak LOCATION Adds a one-use breakpoint that deletes itself after stopping once.
info breakpoints Shows breakpoint numbers, conditions, locations, and enabled state.
disable N / enable N Temporarily turns breakpoint N off or back on.
delete N Removes breakpoint N.

For PIE, a static address from a file may not match the live mapping. Set the breakpoint by symbol or calculate the runtime address after the binary loads. If a symbol is unavailable, use starti, inspect mappings, and add the binary base to its static offset.

Conditional breakpoints stop only when an expression is true:

break *main+36 if $rax == 0

Conditions are evaluated in the current program context. Confirm the register or variable has the expected meaning at that instruction.

start # stop at main when possible
starti # stop at the first instruction
run # run from the beginning
run < input.txt # use a reproducible input file
set args --verbose # set command-line arguments
show args
continue # c
kill
run
Command What it does
start Runs to main when GDB can identify it.
starti Runs to the first instruction, even if symbols are missing.
run / r Starts or restarts the program.
run < input.txt Supplies repeatable stdin from a file.
set args ... Sets the program’s command-line arguments for the next run.
show args Prints the current argument string.
continue / c Resumes from the current stop.
kill Stops the current process while leaving GDB open.

When a program exits, run starts it again. Use kill to stop a process still running. For interactive input, continue to the prompt and provide input in the debugger terminal.

next # n: source line, step over calls
step # s: source line, step into calls
nexti # ni: one instruction, step over calls
stepi # si: one instruction, step into calls
finish # finish current function
continue
Command What it does
next / n Executes one source line and steps over calls.
step / s Executes one source line and enters calls when source is available.
nexti / ni Executes one machine instruction, stepping over a call.
stepi / si Executes one machine instruction, stepping into a call.
finish Continues until the current function returns.
continue Runs until another stop or program exit.

For assembly-level work, ni and si are the most predictable. ni executes a call completely and stops at the following instruction; si enters the called function.

catch signal SIGSEGV
run

catch signal SIGSEGV asks GDB to stop when the process receives a segmentation-fault signal. run then starts the program; when it faults, inspect registers and stack memory before restarting.

At the stop, record info registers, x/12i $rip, and x/24gx $rsp. If a cyclic pattern was used, find the exact bytes in the saved return slot before calculating the offset. See pattern commands.