# radareorg/radare2 architecture

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

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

## Overview

Radare2 is a command-line reverse-engineering framework: a user opens a binary, inspects or edits it, and can analyze, disassemble, emulate, or debug it. Its libraries cover file access and binary formats, architecture decoding, analysis and search, with scripting and package-management extensions. The README documents the overall capabilities, but sampled source does not expose the main command-to-library wiring; those internal links are therefore dashed and unverified.

Main entry points: [`binr/radare2/radare2.c`](https://github.com/radareorg/radare2/blob/master/binr/radare2/radare2.c) (Radare2 CLI), [`libr/core/cmd_search.inc.c`](https://github.com/radareorg/radare2/blob/master/libr/core/cmd_search.inc.c) (Search Commands), [`libr/debug/dsession.c`](https://github.com/radareorg/radare2/blob/master/libr/debug/dsession.c) (Debugging), [`libr/cons/dietline.c`](https://github.com/radareorg/radare2/blob/master/libr/cons/dietline.c) (Console Editing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["User Interface"]
  node_radare2["Radare2 CLI<br/>[radare2.c]"]
  node_console["Console Editing<br/>[dietline.c]"]
end

subgraph group_access["Binary Access"]
  node_io["IO and Memory<br/>[io_bank.c]"]
  node_formats["Binary Formats<br/>[bin.c]"]
  node_magic["File Identification<br/>[apprentice.c]"]
  node_grubfs["Filesystem Access<br/>[main.c]"]
end

subgraph group_inspect["Analysis and Inspection"]
  node_architecture["Architecture Decoding<br/>[arch.c]"]
  node_assembler["Assembly<br/>[asm.c]"]
  node_analysis["Program Analysis<br/>[fcn.c]"]
  node_searchcmd["Search Commands<br/>[cmd_search.inc.c]"]
  node_gadgets["Gadget Search"]
  node_syscalls["Syscall Search<br/>[cmd_scsearch.inc.c]"]
  node_search["Search Engine<br/>[search.c]"]
end

subgraph group_extend["Execution and Extensions"]
  node_debugger["Debugging<br/>[dsession.c]"]
  node_winkd["Windows Debug Transport<br/>[winkd.c]"]
  node_scripting["Embedded Scripting<br/>[lang.c]"]
  node_packages["Plugin Packages<br/>[r2pm.c]"]
end

node_user(("Engineer"))

node_user -->|"invokes"| node_radare2
node_radare2 -.->|"offers editing"| node_console
node_radare2 -.->|"opens and edits"| node_io
node_radare2 -.->|"inspects binaries"| node_formats
node_radare2 -.->|"identifies files"| node_magic
node_radare2 -.->|"accesses filesystems"| node_grubfs
node_radare2 -.->|"disassembles"| node_architecture
node_radare2 -.->|"assembles"| node_assembler
node_radare2 -.->|"analyzes programs"| node_analysis
node_radare2 -.->|"searches binaries"| node_searchcmd
node_searchcmd -->|"dispatches to"| node_gadgets
node_searchcmd -->|"uses helpers"| node_syscalls
node_searchcmd -.->|"uses engine"| node_search
node_radare2 -.->|"debugs programs"| node_debugger
node_debugger -.->|"may use transport"| node_winkd
node_radare2 -.->|"runs scripts"| node_scripting
node_user -->|"manages extensions"| node_packages

click node_radare2 "https://github.com/radareorg/radare2/blob/master/binr/radare2/radare2.c"
click node_console "https://github.com/radareorg/radare2/blob/master/libr/cons/dietline.c"
click node_io "https://github.com/radareorg/radare2/blob/master/libr/io/io_bank.c"
click node_formats "https://github.com/radareorg/radare2/blob/master/libr/bin/bin.c"
click node_magic "https://github.com/radareorg/radare2/blob/master/libr/magic/apprentice.c"
click node_grubfs "https://github.com/radareorg/radare2/blob/master/libr/fs/p/grub/main.c"
click node_architecture "https://github.com/radareorg/radare2/blob/master/libr/arch/arch.c"
click node_assembler "https://github.com/radareorg/radare2/blob/master/libr/asm/asm.c"
click node_analysis "https://github.com/radareorg/radare2/blob/master/libr/anal/fcn.c"
click node_searchcmd "https://github.com/radareorg/radare2/blob/master/libr/core/cmd_search.inc.c"
click node_gadgets "https://github.com/radareorg/radare2/blob/master/libr/core/cmd_search_gadget.inc.c"
click node_syscalls "https://github.com/radareorg/radare2/blob/master/libr/core/cmd_scsearch.inc.c"
click node_search "https://github.com/radareorg/radare2/blob/master/libr/search/search.c"
click node_debugger "https://github.com/radareorg/radare2/blob/master/libr/debug/dsession.c"
click node_winkd "https://github.com/radareorg/radare2/blob/master/shlr/winkd/winkd.c"
click node_scripting "https://github.com/radareorg/radare2/blob/master/libr/lang/lang.c"
click node_packages "https://github.com/radareorg/radare2/blob/master/binr/r2pm/r2pm.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_radare2,node_console toneBlue
class node_io,node_formats,node_magic,node_grubfs toneAmber
class node_architecture,node_assembler,node_analysis,node_searchcmd,node_gadgets,node_syscalls,node_search toneMint
class node_debugger,node_winkd,node_scripting,node_packages toneRose
class node_user toneIndigo
```

## Components

### User Interface

- [Radare2 CLI](https://github.com/radareorg/radare2/blob/master/binr/radare2/radare2.c): `binr/radare2/radare2.c`
- [Console Editing](https://github.com/radareorg/radare2/blob/master/libr/cons/dietline.c): `libr/cons/dietline.c`

### Binary Access

- [IO and Memory](https://github.com/radareorg/radare2/blob/master/libr/io/io_bank.c): `libr/io/io_bank.c`
- [Binary Formats](https://github.com/radareorg/radare2/blob/master/libr/bin/bin.c): `libr/bin/bin.c`
- [File Identification](https://github.com/radareorg/radare2/blob/master/libr/magic/apprentice.c): `libr/magic/apprentice.c`
- [Filesystem Access](https://github.com/radareorg/radare2/blob/master/libr/fs/p/grub/main.c): `libr/fs/p/grub/main.c`

### Analysis and Inspection

- [Architecture Decoding](https://github.com/radareorg/radare2/blob/master/libr/arch/arch.c): `libr/arch/arch.c`
- [Assembly](https://github.com/radareorg/radare2/blob/master/libr/asm/asm.c): `libr/asm/asm.c`
- [Program Analysis](https://github.com/radareorg/radare2/blob/master/libr/anal/fcn.c): `libr/anal/fcn.c`
- [Search Commands](https://github.com/radareorg/radare2/blob/master/libr/core/cmd_search.inc.c): `libr/core/cmd_search.inc.c`
- [Gadget Search](https://github.com/radareorg/radare2/blob/master/libr/core/cmd_search_gadget.inc.c): `libr/core/cmd_search_gadget.inc.c`
- [Syscall Search](https://github.com/radareorg/radare2/blob/master/libr/core/cmd_scsearch.inc.c): `libr/core/cmd_scsearch.inc.c`
- [Search Engine](https://github.com/radareorg/radare2/blob/master/libr/search/search.c): `libr/search/search.c`

### Execution and Extensions

- [Debugging](https://github.com/radareorg/radare2/blob/master/libr/debug/dsession.c): `libr/debug/dsession.c`
- [Windows Debug Transport](https://github.com/radareorg/radare2/blob/master/shlr/winkd/winkd.c): `shlr/winkd/winkd.c`
- [Embedded Scripting](https://github.com/radareorg/radare2/blob/master/libr/lang/lang.c): `libr/lang/lang.c`
- [Plugin Packages](https://github.com/radareorg/radare2/blob/master/binr/r2pm/r2pm.c): `binr/r2pm/r2pm.c`

### Other components

- **Engineer**

## Connections

- Engineer → Radare2 CLI: invokes (evidence: `README.md`)
- Radare2 CLI → Console Editing: offers editing
- Radare2 CLI → IO and Memory: opens and edits
- Radare2 CLI → Binary Formats: inspects binaries
- Radare2 CLI → File Identification: identifies files
- Radare2 CLI → Filesystem Access: accesses filesystems
- Radare2 CLI → Architecture Decoding: disassembles
- Radare2 CLI → Assembly: assembles
- Radare2 CLI → Program Analysis: analyzes programs
- Radare2 CLI → Search Commands: searches binaries
- Search Commands → Gadget Search: dispatches to (evidence: `libr/core/cmd_search.inc.c`)
- Search Commands → Syscall Search: uses helpers (evidence: `libr/core/cmd_search.inc.c`)
- Search Commands → Search Engine: uses engine
- Radare2 CLI → Debugging: debugs programs
- Debugging → Windows Debug Transport: may use transport
- Radare2 CLI → Embedded Scripting: runs scripts
- Engineer → Plugin Packages: manages extensions (evidence: `README.md`)
