# epicgamesext/raddebugger architecture

> Architecture diagram of the GitHub repository epicgamesext/raddebugger, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/epicgamesext/raddebugger
- Repository: https://github.com/epicgamesext/raddebugger

## Overview

##### Overall Structure and Main Components
- Within the Debugger subsystem, include major components such as:
- Core Debugger Engine (from layers like “dbg_engine”, “ctrl”, “demon”, “dbgi”)
- Debug Info Conversion and Handling (the “rdi_from_pdb”, “rdi_from_dwarf”, “rdi_dump”, “lib_rdi_format”, “lib_rdi_make” layers)
- Expression Evaluation and Visualization (from “eval” and “eval_visualization”)
- Auxiliary services like asynchronous processing (“async”), file and data caching (“file_stream”, “hash_store”, “geo_cache”, “text_cache”, “texture_cache”, “font_cache”), and code parsing (e.g., “codeview”, “coff”, “msf”, “pdb”).
- OS and Graphics Abstraction layers (from “os/core”, “os/gfx”, “font_provider”)
- Core Linker functionality (organized within the “linker” folder – which includes a number of files handling object files, symbol tables, exports/imports, etc.)
- Integration with debug info generation (show using parts of the RDI system)
- Support for threading and performance optimizations (e.g., use of thread pools in “linker/thread_pool”)

##### Component Relationships and Interactions
- That both subsystems rely on a core “Base” layer (the “base” folder) which provides utilities for memory management, command-line parsing, logging, and profiling.
- How the Debugger’s core engine drives the UI components, sending commands and receiving data from the evaluation layers.
- Asynchronous work system (the “async” layer) as an infrastructure service that multiple components (like disassembly cache “dasm_cache”, file streaming “file_stream”, and geometric/text caches) depend on.

##### Architectural Patterns and Design Principles
- A layered architecture, with each folder representing a “layer” (which is also reflected in the namespace conventions found in the code – such as ASYNC_, BASE_, CV_, etc.).
- That the layers form a Directed Acyclic Graph (DAG) wherein lower-level layers (such as “base”, “os/core”) provide services on which higher-level layers build.
- Modularity: many layers (especially those prefixed with “lib_”) are designed to be independent and reuseable in other projects.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Base Infrastructure
    subgraph "Base Infrastructure"
        Base["Base Utilities"]
    end

    %% RAD Debugger Subsystem
    subgraph "RAD Debugger"
        %% Debugger Frontend/UI
        subgraph "Debugger Frontend/UI"
            UI["UI"]
            Draw["Draw"]
            Render["Render"]
            Raddbg["RAD Debugger"]
        end

        %% Core Debugger Engine
        subgraph "Core Debugger Engine"
            DebugEngine["Debug Engine"]
            Control["Control Layer"]
            Demon["Debug Daemon"]
            Dbgi["Debug Info Infra"]
        end

        %% Debug Info Conversion and Handling
        subgraph "Debug Info Conversion"
            RdiPdb["RDI from PDB"]
            RdiDwarf["RDI from DWARF"]
            LibRdiFormat["RDI Format Library"]
            LibRdiMake["RDI Make Library"]
        end

        %% Expression Evaluation and Visualization
        subgraph "Expression Evaluation"
            Eval["Expression Evaluation"]
            EvalVis["Evaluation Visualization"]
        end

        %% Auxiliary Services
        subgraph "Auxiliary Services"
            Async["Async Processing"]
            FileStream["File Stream & Cache"]
            HashStore["Hash Storage"]
            GeoCache["Geometric Cache"]
            TextCache["Text Cache"]
            TextureCache["Texture Cache"]
            FontCache["Font Cache"]
            CodeView["Codeview Parser"]
            Coff["COFF Parser"]
            MSF["MSF Parser"]
            PdbParser["PDB Parser"]
        end

        %% OS and Graphics Abstraction
        subgraph "OS and Graphics Abstraction"
            OsCore["OS Core"]
            OsGfx["Graphics Abstraction"]
            FontProvider["Font Provider"]
        end
    end

    %% RAD Linker Subsystem
    subgraph "RAD Linker"
        %% Core Linker Functionality
        subgraph "Core Linker Functionality"
            Linker["Core Linker"]
            LinkerRdi["Linker Debug Info Integration"]
        end

        %% Threading and Performance
        subgraph "Threading and Performance"
            ThreadPool["Thread Pool Support"]
        end
    end

    %% Relationships

    %% Base dependencies
    Base -->|"supports"| DebugEngine
    Base -->|"supports"| Linker

    %% Debugger Core drives UI
    DebugEngine -->|"drives"| UI
    DebugEngine -->|"drives"| Draw
    DebugEngine -->|"drives"| Render
    DebugEngine -->|"drives"| Raddbg

    %% Core Debugger Engine Structure
    DebugEngine --- Control
    DebugEngine --- Demon
    DebugEngine --- Dbgi

    %% Debug Info Conversion feeds into Debug Engine and Linker
    RdiPdb -->|"feeds"| DebugEngine
    RdiDwarf -->|"feeds"| DebugEngine
    LibRdiFormat -->|"feeds"| DebugEngine
    LibRdiMake -->|"feeds"| DebugEngine
    LibRdiMake -->|"feeds"| Linker

    %% Expression Evaluation connections
    DebugEngine -->|"evaluates"| Eval
    Eval -->|"visualized by"| EvalVis
    Eval -->|"updates"| UI

    %% Asynchronous Services support Auxiliary Services
    Async -->|"supports"| FileStream
    Async -->|"supports"| HashStore
    Async -->|"supports"| GeoCache
    Async -->|"supports"| TextCache
    Async -->|"supports"| TextureCache
    Async -->|"supports"| FontCache
    Async -->|"supports"| CodeView
    Async -->|"supports"| Coff
    Async -->|"supports"| MSF
    Async -->|"supports"| PdbParser

    %% Code Parsing provides info to Debug Engine
    CodeView -->|"parses"| DebugEngine
    Coff -->|"parses"| DebugEngine
    MSF -->|"parses"| DebugEngine
    PdbParser -->|"parses"| DebugEngine

    %% OS and Graphics Abstraction feeds into UI components
    OsCore -->|"renders"| Draw
    OsCore -->|"supports"| UI
    OsGfx -->|"renders"| Draw
    OsGfx -->|"supports"| UI
    FontProvider -->|"provides"| UI

    %% Linker relationships
    ThreadPool -->|"optimizes"| Linker
    LinkerRdi -->|"integrates debug info"| Linker

    %% Styling
    class Base baseStyle
    class UI,Draw,Render,Raddbg,DebugEngine,Control,Demon,Dbgi debuggerStyle
    class RdiPdb,RdiDwarf,LibRdiFormat,LibRdiMake conversionStyle
    class Eval,EvalVis evaluationStyle
    class Async,FileStream,HashStore,GeoCache,TextCache,TextureCache,FontCache,CodeView,Coff,MSF,PdbParser auxStyle
    class OsCore,OsGfx,FontProvider osStyle
    class Linker,LinkerRdi,ThreadPool linkerStyle

    %% Class Definitions with Colors
    classDef baseStyle fill:#AED6F1,stroke:#1B4F72,stroke-width:2px;
    classDef debuggerStyle fill:#F9E79F,stroke:#B9770E,stroke-width:2px;
    classDef conversionStyle fill:#D4E6F1,stroke:#1F618D,stroke-width:2px;
    classDef evaluationStyle fill:#D5F5E3,stroke:#28B463,stroke-width:2px;
    classDef auxStyle fill:#FADBD8,stroke:#E74C3C,stroke-width:2px;
    classDef osStyle fill:#E8DAEF,stroke:#8E44AD,stroke-width:2px;
    classDef linkerStyle fill:#D6EAF8,stroke:#2874A6,stroke-width:2px;

    %% Click Events
    click UI "https://github.com/epicgamesext/raddebugger/tree/master/src/ui"
    click Draw "https://github.com/epicgamesext/raddebugger/tree/master/src/draw"
    click Render "https://github.com/epicgamesext/raddebugger/tree/master/src/render"
    click Raddbg "https://github.com/epicgamesext/raddebugger/tree/master/src/raddbg"

    click DebugEngine "https://github.com/epicgamesext/raddebugger/tree/master/src/dbg_engine"
    click Control "https://github.com/epicgamesext/raddebugger/tree/master/src/ctrl"
    click Demon "https://github.com/epicgamesext/raddebugger/tree/master/src/demon"
    click Dbgi "https://github.com/epicgamesext/raddebugger/tree/master/src/dbgi"

    click RdiPdb "https://github.com/epicgamesext/raddebugger/tree/master/src/rdi_from_pdb"
    click RdiDwarf "https://github.com/epicgamesext/raddebugger/tree/master/src/rdi_from_dwarf"
    click LibRdiFormat "https://github.com/epicgamesext/raddebugger/tree/master/src/lib_rdi_format"
    click LibRdiMake "https://github.com/epicgamesext/raddebugger/tree/master/src/lib_rdi_make"

    click Eval "https://github.com/epicgamesext/raddebugger/tree/master/src/eval"
    click EvalVis "https://github.com/epicgamesext/raddebugger/tree/master/src/eval_visualization"

    click Async "https://github.com/epicgamesext/raddebugger/tree/master/src/async"
    click FileStream "https://github.com/epicgamesext/raddebugger/tree/master/src/file_stream"
    click HashStore "https://github.com/epicgamesext/raddebugger/tree/master/src/hash_store"
    click GeoCache "https://github.com/epicgamesext/raddebugger/tree/master/src/geo_cache"
    click TextCache "https://github.com/epicgamesext/raddebugger/tree/master/src/text_cache"
    click TextureCache "https://github.com/epicgamesext/raddebugger/tree/master/src/texture_cache"
    click FontCache "https://github.com/epicgamesext/raddebugger/tree/master/src/font_cache"
    click CodeView "https://github.com/epicgamesext/raddebugger/tree/master/src/codeview"
    click Coff "https://github.com/epicgamesext/raddebugger/tree/master/src/coff"
    click MSF "https://github.com/epicgamesext/raddebugger/tree/master/src/msf"
    click PdbParser "https://github.com/epicgamesext/raddebugger/tree/master/src/pdb"

    click OsCore "https://github.com/epicgamesext/raddebugger/tree/master/src/os/core"
    click OsGfx "https://github.com/epicgamesext/raddebugger/tree/master/src/os/gfx"
    click FontProvider "https://github.com/epicgamesext/raddebugger/tree/master/src/font_provider"

    click Linker "https://github.com/epicgamesext/raddebugger/tree/master/src/linker"
    click LinkerRdi "https://github.com/epicgamesext/raddebugger/tree/master/src/linker/rdi"
    click ThreadPool "https://github.com/epicgamesext/raddebugger/tree/master/src/linker/thread_pool"
    click Base "https://github.com/epicgamesext/raddebugger/tree/master/src/base"
```
