Architectural Overview
Ghidra is built as a layered framework with clear separation of concerns. Each layer builds upon the services provided by lower layers, creating a modular and extensible architecture.Framework Layer
The framework layer provides core infrastructure services that all higher layers depend on.Project Management Module
Location:Ghidra/Framework/Project/
The Project module manages the lifecycle of projects, tools, and domain files:
- DefaultProject - Main project implementation
- ProjectData - File system abstraction for domain files
- ToolManager - Manages tool instances and configurations
- DomainObjectAdapter - Base implementation for persistent objects
Database Module
Location:Ghidra/Framework/DB/
Provides a custom file-based database optimized for Ghidra’s needs:
- Buffer Management - Efficient paging of database content
- Versioning - Built-in version control with undo/redo
- Transactions - ACID transaction support
- Indexing - B-tree indexes for fast lookups
- Schema Evolution - Handles database schema changes
ghidra/framework/model/DomainObject.java:472-484
Docking Module
Location:Ghidra/Framework/Docking/
Provides the windowing system for Ghidra’s user interface:
- ComponentProvider - Base class for dockable windows
- DockingWindowManager - Manages window layout and persistence
- ActionContext - Context for executing user actions
- DockingAction - Represents menu items and toolbar buttons
Generic Module
Location:Ghidra/Framework/Generic/
Common utilities and infrastructure:
- Application - Application lifecycle management
- TaskMonitor - Progress monitoring and cancellation
- ClassSearcher - Dynamic class discovery via ExtensionPoint
- Options - Configuration and preferences system
Software Modeling Layer
The software modeling layer provides the program model and analysis infrastructure. Location:Ghidra/Framework/SoftwareModeling/
Program Model
The central abstraction for representing executable programs:Memory Manager
Memory Manager
Manages memory blocks, address spaces, and byte accessFrom
ghidra/program/model/mem/Memory.java:30-79Symbol Table
Symbol Table
Manages symbols, namespaces, and labels
- Labels and function names
- Namespace hierarchy
- Symbol references and scope
- External symbols
Function Manager
Function Manager
Tracks functions and their properties
- Function boundaries
- Parameters and return values
- Local variables
- Call relationships
Reference Manager
Reference Manager
Tracks memory references and cross-references
- Code and data references
- Stack references
- External references
- Reference types and offsets
Address Model
Addresses in Ghidra are multi-dimensional:ghidra/program/model/address/AddressSpace.java:28-46
Address spaces allow Ghidra to represent different contexts within a program:
- RAM - Physical memory
- REGISTER - Processor registers
- STACK - Stack-relative addressing
- OTHER - Non-loaded data (headers, debug info)
- EXTERNAL - External library references
ghidra/program/model/address/AddressSpace.java:68-89
Language System
Processor specifications define instruction semantics:- SLEIGH - Domain-specific language for instruction encoding
- Processor Definitions - Located in
Ghidra/Processors/ - P-code - Intermediate representation for analysis
- Compiler Specifications - Calling conventions and ABI details
Features Layer
The features layer provides user-facing functionality built on the framework.Base Module
Location:Ghidra/Features/Base/
Core analysis features and the CodeBrowser tool:
Analysis Services:
- Disassembly and instruction analysis
- Function discovery and boundaries
- Stack analysis and parameter detection
- Reference discovery
- Data type propagation
- Symbol demangling
ghidra/app/services/Analyzer.java:28-44
Decompiler Module
Location:Ghidra/Features/Decompiler/
- C++ Native Engine - High-performance decompilation
- Java Integration - Bridge between native and Java layers
- High P-code - Simplified intermediate representation
- Type Recovery - Infer data types from usage
File Formats Module
Location:Ghidra/Features/FileFormats/
Binary format parsers and loaders:
- PE (Windows executables)
- ELF (Linux/Unix executables)
- Mach-O (macOS executables)
- COFF archives
- Android formats (DEX, VDEX, ART)
Component Interactions
Here’s how components work together during typical operations:Opening a Program
Performing Analysis
From
ghidra/app/plugin/core/analysis/AutoAnalysisManager.java:57-63
Extension Points
Ghidra provides multiple extension mechanisms:Plugin Extension
Analyzer Extension
Loader Extension
Custom file format loaders implement the Loader interface.Language Extension
New processor support via SLEIGH specifications.Performance Considerations
Module Dependencies
The dependency hierarchy ensures clean layering:Next Steps
Projects
Learn about project organization and version control
Programs
Deep dive into the program model
Analysis
Understand the analysis pipeline
Overview
Return to framework overview
