R_BP(3)
π R_BP(3) β the radare2 breakpoint library, bestie edition π
okay so this is a page from the Library Functions Manual (section 3, the "C library functions" girlies π), and it's all about r_bp β the radare2 breakpoint library. Sit down, grab a strawberry π, we're doing breakpoints.
β¨ NAME β¨
This part is just the vibe check: it gives you the manual page name plus a short little description of the r_bp library, so you can clock what this document is about in like two seconds. And here it is:
r_bpβ radare2 breakpoint library π
β¨ SYNOPSIS β¨
Here's the primary header you include when you're using the r_bp API, plus a high-level cue about how you reference the functions in this manual:
#include <r_bp.h>
That's it. That's the door. Walk in π
β¨ DESCRIPTION β¨
This section gives you the overview of the r_bp library and the kinds of breakpoint / watchpoint functionality it hands you. π¦
The r_bp library provides breakpoint management for radare2, and it supports:
- software breakpoints
- hardware breakpoints
- watchpoints
- conditional breakpoints
β¦across different architectures. No cap, all of them. π
The core structure is RBreakpoint, which manages the breakpoint lists, the plugins, and the tracing functionality. She's the main character fr π
β¨ INITIALIZATION β¨
This is the starting point β how you create and destroy a breakpoint context. Baby's first r_bp π«Ά
RBreakpoint * r_bp_new(void)
Creates a new breakpoint context, with the built-in plugins already loaded. Fresh out the box, slay β¨
RBreakpoint * r_bp_free(RBreakpoint *bp)
Frees all the resources associated with the breakpoint context. Clean up after yourself bestie, we don't leave mess π
β¨ BREAKPOINT MANAGEMENT β¨
This section documents the functions that add, remove and manage individual breakpoints and watchpoints β the core primitives for inserting and removing breakpoints. The bread and butter, iykyk π
RBreakpointItem * r_bp_add_sw(RBreakpoint *bp, ut64 addr, int size, int perm)
Adds a software breakpoint at the specified address. π
RBreakpointItem * r_bp_add_hw(RBreakpoint *bp, ut64 addr, int size, int perm)
Adds a hardware breakpoint at the specified address. π₯
RBreakpointItem * r_bp_watch_add(RBreakpoint *bp, ut64 addr, int size, int hw, int rw)
Adds a watchpoint</watchpoint> at the specified address. π
bool r_bp_del(RBreakpoint *bp, ut64 addr)
Deletes the breakpoint at the specified address. bye bye π¦
bool r_bp_del_all(RBreakpoint *bp)
Deletes all the breakpoints. Everything. Gone. π
β¨ BREAKPOINT CONTROL β¨
These let you enable, disable or change the state of breakpoints β globally or one at a time. The controls, basically ποΈ
RBreakpointItem * r_bp_enable(RBreakpoint *bp, ut64 addr, int set, int count)
Enables or disables the breakpoint at the specified address. β
void r_bp_enable_all(RBreakpoint *bp, int set)
Enables or disables all the breakpoints at once. Group decision energy π
β¨ BREAKPOINT QUERY β¨
Query helpers let you inspect and locate breakpoints by address or by permissions. Use these when you need to check whether a breakpoint is even there, or which one covers an address. Detective mode π
RBreakpointItem * r_bp_get_at(RBreakpoint *bp, ut64 addr)
Gets the breakpoint at the specified address. π
RBreakpointItem * r_bp_get_in(RBreakpoint *bp, ut64 addr, int perm)
Gets the breakpoint that covers the specified address, with the given permissions. π«Ά
int r_bp_in(RBreakpoint *bp, ut64 addr, int perm)
Checks if there's a breakpoint at the specified address with the given permissions. yes/no, simple as πΈ
β¨ BREAKPOINT LISTING β¨
Listing utilities give you human-readable or machine-oriented representations of your current breakpoints, plus counts and summaries for diagnostics. Receipts π
char * r_bp_list(RBreakpoint *bp, int rad)
Lists all the breakpoints in the specified format. β¨
int r_bp_size(RBreakpoint *bp)
Returns the number of breakpoints. Math but make it cute π’
β¨ CONDITIONAL BREAKPOINTS β¨
Conditional breakpoints let you attach expressions or conditions to a breakpoint so it only triggers when that condition holds. Very picky, very demure π
bool r_bp_add_cond(RBreakpoint *bp, const char *cond)
Adds a conditional breakpoint with the specified condition. π§
bool r_bp_del_cond(RBreakpoint *bp, int idx)
Deletes the conditional breakpoint at the specified index. βοΈ
β¨ FAULT BREAKPOINTS β¨
Fault breakpoints detect memory faults or exceptional accesses. Short section, big job π¨
void r_bp_add_fault(RBreakpoint *bp, ut64 addr, int size, int perm)
Adds a fault breakpoint at the specified address. π«Ά
β¨ TRACING β¨
Tracing features let you record execution or breakpoint hit information. The functions here turn tracing on per-breakpoint, or globally. You're literally keeping a diary of hits π
bool r_bp_set_trace(RBreakpoint *bp, ut64 addr, int set)
Enables or disables tracing for the breakpoint at the specified address. π₯
void r_bp_set_trace_all(RBreakpoint *bp, int set)
Enables or disables tracing for all the breakpoints. π
β¨ PLUGINS β¨
The plugin API lets you extend the breakpoint system with your own custom backends or behavior. Use these to register and select plugins β build-a-bear but for breakpoints π§Έ
int r_bp_plugin_add(RBreakpoint *bp, RBreakpointPlugin *plugin)
Adds a breakpoint plugin. β¨
int r_bp_plugin_remove(RBreakpoint *bp, RBreakpointPlugin *plugin)
Removes a breakpoint plugin. π¦
int r_bp_use(RBreakpoint *bp, const char *name, int bits)
Selects the breakpoint plugin to use. π
β¨ RESTORATION β¨
Restoration functions give you a way to reapply or roll back breakpoint changes β like when you're resuming or detaching from a process. Undo button, but make it a syscall β©οΈ
int r_bp_restore(RBreakpoint *bp, bool set)
Restores all the breakpoints to their original state. πΈ
void r_bp_restore_one(RBreakpoint *bp, RBreakpointItem *b, bool set)
Restores a single breakpoint. Just the one, bestie π
β¨ TRAPTRACE β¨
Trap tracing collects ranges and events for traps and exceptions. This is how you enable it, reset it, and manage those ranges πΈοΈ
void r_bp_traptrace_enable(RBreakpoint *bp, int enable)
Enables or disables trap tracing. π
void r_bp_traptrace_reset(RBreakpoint *bp, int hard)
Resets trap tracing. π§Ό
int r_bp_traptrace_add(RBreakpoint *bp, ut64 from, ut64 to)
Adds a trap trace range. π
β¨ BREAKPOINT TYPES β¨
Here are the supported breakpoint kinds, with a quick note on what each one is for. Pick your fighter βοΈ
The library supports these different breakpoint types:
R_BP_TYPE_SWβ software breakpoint πR_BP_TYPE_HWβ hardware breakpoint π₯R_BP_TYPE_CONDβ conditional breakpoint π§R_BP_TYPE_FAULTβ fault breakpoint π¨
β¨ PERMISSIONS β¨
Permission flags describe what kind of memory accesses the breakpoint should be watching. Consult these when you're making watchpoints or specifying protection semantics. Choose wisely π«Ά
Breakpoints can have these different permissions:
R_BP_PROT_EXECβ execute permission βR_BP_PROT_WRITEβ write permission βοΈR_BP_PROT_READβ read permission πR_BP_PROT_ACCESSβ access permission π
β¨ EXAMPLES β¨
Quick reference time β these little snippets show the common tasks: making contexts, adding breakpoints, hardware breakpoints, watchpoints and conditional breakpoints. Copy, paste, slay π
Basic breakpoint setup:
RBreakpoint *bp = r_bp_new();
RBreakpointItem *b = r_bp_add_sw(bp, 0x400000, 1, R_BP_PROT_EXEC);
Hardware breakpoint:
RBreakpointItem *hw = r_bp_add_hw(bp, 0x400010, 4, R_BP_PROT_EXEC);
Watchpoint:
RBreakpointItem *wp = r_bp_watch_add(bp, 0x600000, 8, 1, R_BP_PROT_WRITE);
Conditional breakpoint:
r_bp_add_cond(bp, "rax == 0x1234");
β¨ SEE ALSO β¨
go read these next, they're the friend group π«Ά
okay that's the whole page!! π this one came from Debian, dated September 20, 2025, and it lives at R_BP(3) in section 3 of the manual. go forth and breakpoint responsibly, bestie πβ¨π¦
π¦ where this page comes from
- alpine 3.24: radare2-doc 6.1.6-r0 Β· GPL-3.0-or-later AND LGPL-2.0-or-later AND LGPL-2.1-or-later
- arch rolling: radare2 6.2.2-1 Β· GPL-3.0-only AND LGPL-3.0-only
- nixos 26.05: radare2 6.1.8
- nixpkgs unstable: radare2 6.2.4
- opensuse-leap 16.0: radare2 6.2.2-bp160.1.1 Β· GPL-3.0-only AND LGPL-3.0-only
- opensuse-leap 16.0: radare2 6.2.2-bp160.1.1 Β· GPL-3.0-only AND LGPL-3.0-only
- opensuse-leap 16.0: radare2 6.2.2-bp160.1.1 Β· GPL-3.0-only AND LGPL-3.0-only
- opensuse-leap 16.0: radare2 6.2.2-bp160.1.1 Β· GPL-3.0-only AND LGPL-3.0-only
- ubuntu resolute: radare2 6.0.7+ds-1 Β· LGPL-3.0-only
- ubuntu stonking: radare2 6.1.8+ds-1 Β· LGPL-3.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms