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.
Set and manage breakpoints
Section titled “Set and manage breakpoints”break main # break at a functionbreak vulnerable # break at a known functionbreak *0x401234 # break at an addressbreak *main+36 # break at an offsettbreak *main+36 # one-shot breakpointinfo breakpointsdisable 2enable 2delete 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 == 0Conditions are evaluated in the current program context. Confirm the register or variable has the expected meaning at that instruction.
Launch and restart
Section titled “Launch and restart”start # stop at main when possiblestarti # stop at the first instructionrun # run from the beginningrun < input.txt # use a reproducible input fileset args --verbose # set command-line argumentsshow argscontinue # ckillrun| 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.
Step without losing the thread
Section titled “Step without losing the thread”next # n: source line, step over callsstep # s: source line, step into callsnexti # ni: one instruction, step over callsstepi # si: one instruction, step into callsfinish # finish current functioncontinue| 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.
Break on a crash
Section titled “Break on a crash”catch signal SIGSEGVruncatch 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.