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