# vekendian/stellar architecture

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

- Interactive diagram: https://gitdiagram.com/vekendian/stellar
- Repository: https://github.com/vekendian/stellar

## Overview

Stellar is a C++ ELF/DWARF dumper with both command-line and interactive front ends. Its main workflow opens an ELF, discovers and walks DWARF data (or uses the documented dwarfless path), builds an intermediate type model, then emits either a flat C#-style dump or a source-shaped tree. The graph also retains the TUI, disassembly, and progress/metrics capabilities. Some subsystem links are documented rather than visible in sampled implementation excerpts; those are identified by README evidence.

Main entry points: [`src/app/main.cpp`](https://github.com/vekendian/stellar/blob/main/src/app/main.cpp) (CLI commands), [`src/ir/build.cpp`](https://github.com/vekendian/stellar/blob/main/src/ir/build.cpp) (Model builder), [`src/tui/analysis.cpp`](https://github.com/vekendian/stellar/blob/main/src/tui/analysis.cpp) (TUI analysis), [`src/output/emit_tree.cpp`](https://github.com/vekendian/stellar/blob/main/src/output/emit_tree.cpp) (Source tree emitter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontends["User front ends"]
  node_cli["CLI commands<br/>[main.cpp]"]
  node_tui["Interactive TUI<br/>[app.cpp]"]
  node_analysis["TUI analysis<br/>[analysis.cpp]"]
end

subgraph group_binary["Binary and debug parsing"]
  node_elf["ELF reader<br/>[elf_file.cpp]"]
  node_recovery["Header recovery<br/>[phdr_recovery.cpp]"]
  node_dwarf["DWARF context<br/>[dwarf_context.cpp]"]
  node_units["Unit and DIE reader<br/>[unit.cpp]"]
  node_line["Line tables<br/>[line.cpp]"]
  node_ehframe["EH frame reader<br/>[eh_frame.cpp]"]
  node_disasm["Disassembly<br/>[disasm.cpp]"]
end

subgraph group_model["Model construction"]
  node_build["Model builder<br/>[build.cpp]"]
  node_ir["Intermediate model<br/>[model.cpp]"]
end

subgraph group_output["Dump output"]
  node_flat["Flat C&#35; emitter<br/>[emit_il2cpp.cpp]"]
  node_tree["Source tree emitter<br/>[emit_tree.cpp]"]
  node_normalize["Type normalization<br/>[normalize.cpp]"]
  node_bodies["Function bodies<br/>[bodies.cpp]"]
end

subgraph group_support["Runtime support"]
  node_progress["Progress reporting<br/>[progress.cpp]"]
  node_metrics["Run metrics<br/>[metrics.cpp]"]
end

node_user(("User"))

node_user -->|"runs commands"| node_cli
node_user -->|"launches"| node_tui
node_cli -->|"opens input"| node_elf
node_elf -->|"recovers headers"| node_recovery
node_dwarf -->|"reads ELF view"| node_elf
node_cli -->|"discovers units"| node_dwarf
node_dwarf -->|"walks units"| node_units
node_build -->|"reads debug context"| node_dwarf
node_build -->|"uses function ranges"| node_ehframe
node_build -->|"uses source lines"| node_line
node_cli -->|"builds model"| node_build
node_build -->|"constructs"| node_ir
node_cli -->|"emits dump"| node_flat
node_flat -->|"reads model"| node_ir
node_flat -->|"normalizes types"| node_normalize
node_cli -->|"emits tree"| node_tree
node_tree -->|"reads model"| node_ir
node_tree -->|"normalizes types"| node_normalize
node_tree -->|"uses optional bodies"| node_bodies
node_bodies -.->|"decodes instructions"| node_disasm
node_cli -->|"configures optional bodies"| node_bodies
node_tui -->|"starts analysis"| node_analysis
node_analysis -->|"opens binaries"| node_elf
node_analysis -->|"builds model"| node_build
node_analysis -->|"requests flat output"| node_flat
node_analysis -->|"requests tree output"| node_tree
node_build -->|"updates counters"| node_progress
node_progress -->|"reads counters"| node_metrics

click node_cli "https://github.com/vekendian/stellar/blob/main/src/app/main.cpp"
click node_tui "https://github.com/vekendian/stellar/blob/main/src/tui/app.cpp"
click node_analysis "https://github.com/vekendian/stellar/blob/main/src/tui/analysis.cpp"
click node_elf "https://github.com/vekendian/stellar/blob/main/src/elf/elf_file.cpp"
click node_recovery "https://github.com/vekendian/stellar/blob/main/src/elf/phdr_recovery.cpp"
click node_dwarf "https://github.com/vekendian/stellar/blob/main/src/dwarf/dwarf_context.cpp"
click node_units "https://github.com/vekendian/stellar/blob/main/src/dwarf/unit.cpp"
click node_line "https://github.com/vekendian/stellar/blob/main/src/dwarf/line.cpp"
click node_ehframe "https://github.com/vekendian/stellar/blob/main/src/dwarf/eh_frame.cpp"
click node_build "https://github.com/vekendian/stellar/blob/main/src/ir/build.cpp"
click node_ir "https://github.com/vekendian/stellar/blob/main/src/ir/model.cpp"
click node_flat "https://github.com/vekendian/stellar/blob/main/src/output/emit_il2cpp.cpp"
click node_tree "https://github.com/vekendian/stellar/blob/main/src/output/emit_tree.cpp"
click node_normalize "https://github.com/vekendian/stellar/blob/main/src/output/normalize.cpp"
click node_bodies "https://github.com/vekendian/stellar/blob/main/src/output/bodies.cpp"
click node_disasm "https://github.com/vekendian/stellar/blob/main/src/disasm/disasm.cpp"
click node_progress "https://github.com/vekendian/stellar/blob/main/src/diag/progress.cpp"
click node_metrics "https://github.com/vekendian/stellar/blob/main/src/diag/metrics.cpp"

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_cli,node_tui,node_analysis,node_user toneBlue
class node_elf,node_recovery,node_dwarf,node_units,node_line,node_ehframe,node_disasm toneAmber
class node_build,node_ir toneMint
class node_flat,node_tree,node_normalize,node_bodies toneRose
class node_progress,node_metrics toneIndigo
```

## Components

### User front ends

- [CLI commands](https://github.com/vekendian/stellar/blob/main/src/app/main.cpp): `src/app/main.cpp`
- [Interactive TUI](https://github.com/vekendian/stellar/blob/main/src/tui/app.cpp): `src/tui/app.cpp`
- [TUI analysis](https://github.com/vekendian/stellar/blob/main/src/tui/analysis.cpp): `src/tui/analysis.cpp`

### Binary and debug parsing

- [ELF reader](https://github.com/vekendian/stellar/blob/main/src/elf/elf_file.cpp): `src/elf/elf_file.cpp`
- [Header recovery](https://github.com/vekendian/stellar/blob/main/src/elf/phdr_recovery.cpp): `src/elf/phdr_recovery.cpp`
- [DWARF context](https://github.com/vekendian/stellar/blob/main/src/dwarf/dwarf_context.cpp): `src/dwarf/dwarf_context.cpp`
- [Unit and DIE reader](https://github.com/vekendian/stellar/blob/main/src/dwarf/unit.cpp): `src/dwarf/unit.cpp`
- [Line tables](https://github.com/vekendian/stellar/blob/main/src/dwarf/line.cpp): `src/dwarf/line.cpp`
- [EH frame reader](https://github.com/vekendian/stellar/blob/main/src/dwarf/eh_frame.cpp): `src/dwarf/eh_frame.cpp`
- [Disassembly](https://github.com/vekendian/stellar/blob/main/src/disasm/disasm.cpp): `src/disasm/disasm.cpp`

### Model construction

- [Model builder](https://github.com/vekendian/stellar/blob/main/src/ir/build.cpp): `src/ir/build.cpp`
- [Intermediate model](https://github.com/vekendian/stellar/blob/main/src/ir/model.cpp): `src/ir/model.cpp`

### Dump output

- [Flat C# emitter](https://github.com/vekendian/stellar/blob/main/src/output/emit_il2cpp.cpp): `src/output/emit_il2cpp.cpp`
- [Source tree emitter](https://github.com/vekendian/stellar/blob/main/src/output/emit_tree.cpp): `src/output/emit_tree.cpp`
- [Type normalization](https://github.com/vekendian/stellar/blob/main/src/output/normalize.cpp): `src/output/normalize.cpp`
- [Function bodies](https://github.com/vekendian/stellar/blob/main/src/output/bodies.cpp): `src/output/bodies.cpp`

### Runtime support

- [Progress reporting](https://github.com/vekendian/stellar/blob/main/src/diag/progress.cpp): `src/diag/progress.cpp`
- [Run metrics](https://github.com/vekendian/stellar/blob/main/src/diag/metrics.cpp): `src/diag/metrics.cpp`

### Other components

- **User**

## Connections

- User → CLI commands: runs commands
- User → Interactive TUI: launches
- CLI commands → ELF reader: opens input (evidence: `src/app/main.cpp`)
- ELF reader → Header recovery: recovers headers (evidence: `src/elf/phdr_recovery.cpp`)
- DWARF context → ELF reader: reads ELF view
- CLI commands → DWARF context: discovers units (evidence: `src/app/main.cpp`)
- DWARF context → Unit and DIE reader: walks units
- Model builder → DWARF context: reads debug context
- Model builder → EH frame reader: uses function ranges
- Model builder → Line tables: uses source lines (evidence: `src/ir/build.cpp`)
- CLI commands → Model builder: builds model (evidence: `src/app/main.cpp`)
- Model builder → Intermediate model: constructs
- CLI commands → Flat C# emitter: emits dump (evidence: `src/app/main.cpp`)
- Flat C# emitter → Intermediate model: reads model
- Flat C# emitter → Type normalization: normalizes types (evidence: `src/output/emit_il2cpp.cpp`)
- CLI commands → Source tree emitter: emits tree (evidence: `src/app/main.cpp`)
- Source tree emitter → Intermediate model: reads model
- Source tree emitter → Type normalization: normalizes types (evidence: `src/output/emit_tree.cpp`)
- Source tree emitter → Function bodies: uses optional bodies
- Function bodies → Disassembly: decodes instructions
- CLI commands → Function bodies: configures optional bodies (evidence: `src/app/main.cpp`)
- Interactive TUI → TUI analysis: starts analysis
- TUI analysis → ELF reader: opens binaries (evidence: `src/tui/analysis.cpp`)
- TUI analysis → Model builder: builds model (evidence: `src/tui/analysis.cpp`)
- TUI analysis → Flat C# emitter: requests flat output (evidence: `src/tui/analysis.cpp`)
- TUI analysis → Source tree emitter: requests tree output (evidence: `src/tui/analysis.cpp`)
- Model builder → Progress reporting: updates counters (evidence: `src/ir/build.cpp`)
- Progress reporting → Run metrics: reads counters (evidence: `src/diag/progress.cpp`)
