---
name: "r_bp"
section: "3"
platform: "linux"
package: "radare2"
version: "6.2.2-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/r_bp"
---

# r\_bp(3)

radare2 breakpoint library

## NAME

This section provides the manual page name and a short description of the \`r\_bp\` library so you can quickly identify the purpose of the document. **r\_bp** – radare2 breakpoint library

## SYNOPSIS

The synopsis shows the primary header to include when using the \`r\_bp\` API and gives a high-level cue about how to reference the functions described in this manual.

**#include \<r\_bp.h\>**

## DESCRIPTION

This section gives an overview of the \`r\_bp\` library and the kinds of breakpoint and watchpoint functionality it provides.

The **r\_bp** library provides breakpoint management for radare2, supporting software breakpoints, hardware breakpoints, watchpoints, and conditional breakpoints across different architectures.

The core structure is *RBreakpoint*, which manages breakpoint lists, plugins, and tracing functionality.

## INITIALIZATION

The initialization section describes how to create and destroy a breakpoint context — the starting point for using the \`r\_bp\` API. *RBreakpoint* *\** **r\_bp\_new**(*void*)

Creates a new breakpoint context with built-in plugins loaded.

*RBreakpoint* *\** **r\_bp\_free**(*RBreakpoint \*bp*)

Frees all resources associated with the breakpoint context.

## BREAKPOINT MANAGEMENT

This section documents functions to add, remove and manage individual breakpoints and watchpoints — the core primitives for inserting and removing breakpoints. *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 at the specified address.

*bool* **r\_bp\_del**(*RBreakpoint \*bp*, *ut64 addr*)

Deletes the breakpoint at the specified address.

*bool* **r\_bp\_del\_all**(*RBreakpoint \*bp*)

Deletes all breakpoints.

## BREAKPOINT CONTROL

Breakpoint control functions let you enable, disable or change the state of breakpoints globally or individually; this section explains those controls. *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 breakpoints.

## BREAKPOINT QUERY

Query helpers let you inspect and locate breakpoints by address or permissions; use these when you need to check whether a breakpoint is present or which breakpoint covers an address. *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.

## BREAKPOINT LISTING

Listing utilities produce human-readable or machine-oriented representations of the current breakpoints and provide counts and summaries for diagnostics. *char* *\** **r\_bp\_list**(*RBreakpoint \*bp*, *int rad*)

Lists all breakpoints in the specified format.

*int* **r\_bp\_size**(*RBreakpoint \*bp*)

Returns the number of breakpoints.

## CONDITIONAL BREAKPOINTS

Conditional breakpoints allow expressions or conditions to be attached to breakpoints so they only trigger when the condition holds; this section covers adding and removing those conditions. *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 are used to detect memory faults or exceptional accesses; this short section explains how to register fault-related breakpoints. *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 enable per-breakpoint or global tracing behavior. *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 breakpoints.

## PLUGINS

The plugin API lets you extend the breakpoint system with custom backends or behavior; use these functions to register and select plugins. *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 provide a way to reapply or rollback breakpoint changes, for example when resuming or detaching from a process. *int* **r\_bp\_restore**(*RBreakpoint \*bp*, *bool set*)

Restores all breakpoints to their original state.

*void* **r\_bp\_restore\_one**(*RBreakpoint \*bp*, *RBreakpointItem \*b*, *bool set*)

Restores a single breakpoint.

## TRAPTRACE

Trap tracing collects ranges and events for traps and exceptions; this section shows how to enable, reset 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

This section enumerates the supported breakpoint kinds and briefly explains their intended use-cases and differences. The library supports 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 monitor; consult these when creating watchpoints or specifying protection semantics. Breakpoints can have 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

The examples section provides short code snippets demonstrating common tasks like creating contexts, adding breakpoints, hardware breakpoints, watchpoints, and conditional breakpoints — use these as a quick reference for typical usage. 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

[r\_debug(3)](/r_debug/3.md), [r\_io(3)](/r_io/3.md)
