# radare/radare2 architecture

> Architecture diagram of the GitHub repository radare/radare2, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/radare/radare2
- Repository: https://github.com/radare/radare2

## Overview

Radare2 is a command-line reverse-engineering framework built around opening and inspecting binaries, then analyzing, searching, debugging, and optionally modifying them. The README describes the user workflow and major capabilities; the tree identifies the corresponding libraries and tools. The graph preserves the documented stages and notable subsystems, but source excerpts do not show most cross-library calls, so those relationships are omitted rather than inferred. The r2r runner is excluded as test infrastructure.

Main entry points: [`libr/core`](https://github.com/radare/radare2/tree/master/libr/core) (Interactive core), [`binr/radare2/radare2.c`](https://github.com/radare/radare2/blob/master/binr/radare2/radare2.c) (Radare2 CLI), [`libr/io`](https://github.com/radare/radare2/tree/master/libr/io) (File and memory I/O), [`libr/arch/arch.c`](https://github.com/radare/radare2/blob/master/libr/arch/arch.c) (Architecture support)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["Command-line experience"]
  node_r2["Radare2 CLI<br/>[radare2.c]"]
  node_console["Console input<br/>[dietline.c]"]
  node_core["Interactive core"]
end

subgraph group_binary["Binary access"]
  node_rabin["Binary inspection<br/>[rabin2.c]"]
  node_bin["Binary formats<br/>[bin.c]"]
  node_io["File and memory I/O"]
  node_filesystem["Filesystem plugins"]
end

subgraph group_analysis["Analysis and search"]
  node_arch["Architecture support<br/>[arch.c]"]
  node_asm["Disassembly and assembly<br/>[asm.c]"]
  node_anal["Program analysis<br/>[fcn.c]"]
  node_searchcmd["Search commands<br/>[cmd_search.inc.c]"]
  node_search["Search engine<br/>[search.c]"]
  node_flags["Flags and symbols<br/>[flag.c]"]
end

subgraph group_execution["Execution and scripting"]
  node_debug["Debug sessions<br/>[dsession.c]"]
  node_winkd["Windows debugger<br/>[winkd.c]"]
  node_scripting["Embedded scripting"]
end

subgraph group_extensions["Extensions"]
  node_r2pm["Plugin package manager<br/>[r2pm.c]"]
  node_plugin["Plugins<br/>[anplugs.c]"]
end

node_user(("Engineer"))

node_user -->|"opens binary"| node_r2
node_r2 -.->|"starts session"| node_core
node_core -.->|"opens files"| node_io
node_rabin -.->|"inspects formats"| node_bin
node_core -.->|"loads binaries"| node_bin
node_core -->|"analyzes program"| node_anal
node_core -.->|"runs search commands"| node_searchcmd
node_searchcmd -.->|"executes searches"| node_search
node_core -->|"debugs programs"| node_debug
node_debug -.->|"uses remote backend"| node_winkd
node_core -->|"runs scripts"| node_scripting
node_core -->|"modifies files"| node_io
node_r2 -.->|"reads commands"| node_console
node_core -.->|"selects architecture"| node_arch
node_arch -.->|"decodes instructions"| node_asm
node_core -.->|"uses symbols"| node_flags
node_r2pm -->|"extends capabilities"| node_plugin
node_io -.->|"accesses filesystems"| node_filesystem

click node_r2 "https://github.com/radare/radare2/blob/master/binr/radare2/radare2.c"
click node_console "https://github.com/radare/radare2/blob/master/libr/cons/dietline.c"
click node_core "https://github.com/radare/radare2/tree/master/libr/core"
click node_rabin "https://github.com/radare/radare2/blob/master/binr/rabin2/rabin2.c"
click node_bin "https://github.com/radare/radare2/blob/master/libr/bin/bin.c"
click node_io "https://github.com/radare/radare2/tree/master/libr/io"
click node_filesystem "https://github.com/radare/radare2/tree/master/libr/fs"
click node_arch "https://github.com/radare/radare2/blob/master/libr/arch/arch.c"
click node_asm "https://github.com/radare/radare2/blob/master/libr/asm/asm.c"
click node_anal "https://github.com/radare/radare2/blob/master/libr/anal/fcn.c"
click node_searchcmd "https://github.com/radare/radare2/blob/master/libr/core/cmd_search.inc.c"
click node_search "https://github.com/radare/radare2/blob/master/libr/search/search.c"
click node_flags "https://github.com/radare/radare2/blob/master/libr/flag/flag.c"
click node_debug "https://github.com/radare/radare2/blob/master/libr/debug/dsession.c"
click node_winkd "https://github.com/radare/radare2/blob/master/shlr/winkd/winkd.c"
click node_scripting "https://github.com/radare/radare2/tree/master/libr/lang"
click node_r2pm "https://github.com/radare/radare2/blob/master/binr/r2pm/r2pm.c"
click node_plugin "https://github.com/radare/radare2/blob/master/libr/anal/anplugs.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_r2,node_console,node_core toneBlue
class node_rabin,node_bin,node_io,node_filesystem toneAmber
class node_arch,node_asm,node_anal,node_searchcmd,node_search,node_flags toneMint
class node_debug,node_winkd,node_scripting toneRose
class node_r2pm,node_plugin,node_user toneIndigo
```

## Components

### Command-line experience

- [Radare2 CLI](https://github.com/radare/radare2/blob/master/binr/radare2/radare2.c): `binr/radare2/radare2.c`
- [Console input](https://github.com/radare/radare2/blob/master/libr/cons/dietline.c): `libr/cons/dietline.c`
- [Interactive core](https://github.com/radare/radare2/tree/master/libr/core): `libr/core`

### Binary access

- [Binary inspection](https://github.com/radare/radare2/blob/master/binr/rabin2/rabin2.c): `binr/rabin2/rabin2.c`
- [Binary formats](https://github.com/radare/radare2/blob/master/libr/bin/bin.c): `libr/bin/bin.c`
- [File and memory I/O](https://github.com/radare/radare2/tree/master/libr/io): `libr/io`
- [Filesystem plugins](https://github.com/radare/radare2/tree/master/libr/fs): `libr/fs`

### Analysis and search

- [Architecture support](https://github.com/radare/radare2/blob/master/libr/arch/arch.c): `libr/arch/arch.c`
- [Disassembly and assembly](https://github.com/radare/radare2/blob/master/libr/asm/asm.c): `libr/asm/asm.c`
- [Program analysis](https://github.com/radare/radare2/blob/master/libr/anal/fcn.c): `libr/anal/fcn.c`
- [Search commands](https://github.com/radare/radare2/blob/master/libr/core/cmd_search.inc.c): `libr/core/cmd_search.inc.c`
- [Search engine](https://github.com/radare/radare2/blob/master/libr/search/search.c): `libr/search/search.c`
- [Flags and symbols](https://github.com/radare/radare2/blob/master/libr/flag/flag.c): `libr/flag/flag.c`

### Execution and scripting

- [Debug sessions](https://github.com/radare/radare2/blob/master/libr/debug/dsession.c): `libr/debug/dsession.c`
- [Windows debugger](https://github.com/radare/radare2/blob/master/shlr/winkd/winkd.c): `shlr/winkd/winkd.c`
- [Embedded scripting](https://github.com/radare/radare2/tree/master/libr/lang): `libr/lang`

### Extensions

- [Plugin package manager](https://github.com/radare/radare2/blob/master/binr/r2pm/r2pm.c): `binr/r2pm/r2pm.c`
- [Plugins](https://github.com/radare/radare2/blob/master/libr/anal/anplugs.c): `libr/anal/anplugs.c`

### Other components

- **Engineer**

## Connections

- Engineer → Radare2 CLI: opens binary
- Radare2 CLI → Interactive core: starts session
- Interactive core → File and memory I/O: opens files
- Binary inspection → Binary formats: inspects formats
- Interactive core → Binary formats: loads binaries
- Interactive core → Program analysis: analyzes program
- Interactive core → Search commands: runs search commands (evidence: `libr/core/cmd_search.inc.c`)
- Search commands → Search engine: executes searches
- Interactive core → Debug sessions: debugs programs
- Debug sessions → Windows debugger: uses remote backend
- Interactive core → Embedded scripting: runs scripts
- Interactive core → File and memory I/O: modifies files
- Radare2 CLI → Console input: reads commands
- Interactive core → Architecture support: selects architecture
- Architecture support → Disassembly and assembly: decodes instructions
- Interactive core → Flags and symbols: uses symbols
- Plugin package manager → Plugins: extends capabilities
- File and memory I/O → Filesystem plugins: accesses filesystems
