Skip to main content

Analysis Overview

Ghidra’s analysis system is a sophisticated pipeline that automatically processes programs to identify functions, data structures, references, and other program semantics. The system is designed to be extensible, prioritized, and incremental.

Auto-Analysis Manager

The AutoAnalysisManager coordinates all analysis activities for a program:
Key Responsibilities:
  • Schedule analyzers by priority
  • Manage address sets for incremental analysis
  • Coordinate parallel analysis tasks
  • Track analysis state and progress
  • Handle analysis events and dependencies
From ghidra/app/plugin/core/analysis/AutoAnalysisManager.java:63-150

Analyzer Interface

All analyzers implement the Analyzer interface:

Analyzer Properties

Name

Unique identifier for the analyzer

Type

Classification (bytes, instructions, functions, data)

Priority

Execution order relative to other analyzers

Enablement

Default enabled/disabled state

Analysis Types

Analyzers are categorized by what they analyze:
Analysis Order:
1

Byte Analysis

Process raw bytes to identify patterns and structures
2

Instruction Analysis

Analyze disassembled instructions and code flow
3

Function Analysis

Identify and analyze function boundaries and properties
4

Data Analysis

Identify and type data structures

Analyzer Priorities

Priority determines execution order within each analysis type:
Priority Guidelines:
  • Lower numbers run first
  • Disassembly before function analysis
  • Function analysis before data propagation
  • Reference analysis runs late

Built-in Analyzers

Ghidra includes many standard analyzers:

Core Analyzers

Converts bytes to instructions at entry points and code references.Priority: Very High
Type: Instruction Analyzer
Identifies function entry points using various heuristics:
  • Call targets
  • Code patterns
  • External references
  • Entry points
Priority: High
Type: Function Analyzer
Uses decompiler to identify function parameters and return values.Priority: Medium
Type: Function Signatures Analyzer
Requires the decompiler to be available.
Analyzes stack frame usage to identify local variables and parameters.Priority: Medium
Type: Function Analyzer
Identifies data references from code:
  • Immediate operands
  • Memory references
  • String references
Priority: Low
Type: Instruction Analyzer
Demangles C++ and other mangled symbol names.Priority: Low
Type: Function Analyzer
Supports multiple demangling schemes (GNU, Microsoft, etc.)

Writing Custom Analyzers

Basic Analyzer Template

Analyzer class names must end with “Analyzer” to be discovered by the ClassSearcher system.

Analyzer Best Practices

Always check for cancellation in loops:
Keep the user informed:
Use the MessageLog:
Wrap modifications in transactions:
Document analyzer dependencies and set appropriate priorities.

Analysis Lifecycle

Starting Analysis

Analysis can be triggered multiple ways:

Analysis Flow

Analysis Tasks

Tasks are queued for each analyzer and address range:
From ghidra/app/plugin/core/analysis/AutoAnalysisManager.java:96-103

Parallel Analysis

Some analyzers support parallel execution:
When using parallel analysis, ensure proper synchronization when accessing shared program resources.

Analysis Options

Analyzers can be configured via the analysis options:

Common Options

  • Enable/disable specific analyzers
  • Configure analyzer-specific behavior
  • Set analysis boundaries
  • Control aggressiveness

Analysis State

Programs track whether they’ve been analyzed:
From ghidra/program/model/listing/Program.java:61-64

Incremental Analysis

Ghidra supports incremental re-analysis:
Triggers for Incremental Analysis:
  • User clears code/data
  • Function boundaries change
  • New memory blocks added
  • Data types modified

Analysis Performance

Optimization Tips

Process addresses in batches:
Avoid repeated lookups:
AddressSet is optimized for range operations:
Batch related changes:

Debugging Analyzers

Logging

Testing

Analysis Events

Monitor analysis progress:

Best Practices

  • Keep analyzers focused on one task
  • Document dependencies and requirements
  • Provide meaningful options
  • Handle edge cases gracefully
  • Minimize database access
  • Use efficient data structures
  • Consider parallel execution
  • Profile and optimize hot paths
  • Provide clear progress feedback
  • Allow cancellation
  • Log important findings
  • Document what the analyzer does
  • Test on diverse programs
  • Verify correctness
  • Check performance
  • Test cancellation behavior

Next Steps

Programs

Learn about the program model

Projects

Understand project organization

Architecture

Explore framework architecture

Overview

Return to framework overview