Breakpoints
Breakpoints and watchpoints are used to pause execution at a specific point in the program. This is useful for debugging and reverse engineering. radare2
has a number of commands for managing breakpoints and watchpoints.
Using Breakpoints
The db
submodule is responsible for breakpoints. This module allows you to create, delete, and manage breakpoints. We can use db?
to see the available commands.
You set breakpoints using db
plus the address or symbol. The argument can also be a symbol plus an offset, which radare2
will resolve to its proper address. Here are some examples of setting breakpoints:
Use db
to view the breakpoint list. You can use dbi
to list the breakpoints by index; however, this only shows their address, not their name.
To remove a breakpoint, use db -<name>
or db -<address>
. You can use dbi -<index>
to remove a breakpoint by its index.
Use the dbe
and dbd
commands to enable and disable breakpoints, respectively. The dbie
and dbid
commands work the same way, using indices for their arguments.
Setting Watchpoints
Watchpoints are breakpoints that are triggered when a specific memory address is accessed. This is useful for detecting when a variable is changed. We can use dbw
to set a watchpoint. This takes two arguments: the address to watch and the watch flags (read, write, or both).
The list of watchpoints is stored in db
with the breakpoints.
Last updated