TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/angr/angr/llms.txt
Use this file to discover all available pages before exploring further.
Decompiler analysis converts binary code into human-readable pseudocode. It processes a function through multiple stages including AIL conversion, optimization, region identification, structuring, and code generation.
Constructor
The function to decompile. Can be a
Function object, function name (string), or function address (int).Control flow graph to use. If
None, the most accurate CFG from the knowledge base is used.A list of tuples specifying decompilation options. Each tuple is
(option, value) where option can be a string or DecompilationOption instance.Decompilation preset to use. Available presets:
"default"- Standard optimization passes"basic"- Minimal optimizations for fallback- Custom
DecompilationPresetobject
Custom list of optimization passes. If specified, overrides the preset.
Output flavor. Currently supports
"pseudocode" for C-like code.Whether to immediately run decompilation upon construction.
Whether to generate code output. Set to
False if you only need intermediate representations.Whether to use cached decompilation results if available.
Whether to update the decompilation cache with results.
Additional Parameters
Whether the stack pointer tracker should track memory accesses.
Custom variable knowledge base to use.
List of peephole optimization classes to apply.
Set of variable names that must be structified.
Set of function addresses to inline during decompilation.
Set of desired variable names to preserve.
Maximum depth for collapsing binary operation expressions.
Properties
The code generator instance containing the final pseudocode output.
The Clinic analysis result containing AIL graph and optimization information.
The structured representation of the function after structuring.
The optimized AIL (angr Intermediate Language) graph.
The AIL graph before optimizations, useful for exact instruction-to-AIL mapping.
The region identifier analysis result.
The decompilation cache object.
Dictionary of decompilation notes and warnings.
Code Output
The decompiled code is available through thecodegen property:
CStructuredCodeGenerator Properties
The complete decompiled C-like pseudocode as a string.
Comments associated with expressions in the code.
Comments associated with statements in the code.
Formatting information for constants (hex, decimal, etc.).
Example Usage
Basic Decompilation
Using Presets
Custom Options
Working with AIL
Accessing Intermediate Results
Caching
Error Handling
Function Inlining
Decompilation Stages
The decompiler goes through several stages:- AIL Conversion: Convert VEX IR to AIL (angr Intermediate Language)
- Graph Simplification: Run optimization passes on the AIL graph
- Region Identification: Identify loops, conditionals, and other control structures
- Structuring: Build a structured representation (AST-like)
- Code Generation: Generate C pseudocode from the structured representation
Controlling Stages
Related Analyses
- Clinic: Performs AIL conversion and optimization (used internally)
- RegionIdentifier: Identifies regions in the control flow
- RecursiveStructurer: Structures the code using schemas
- StructuredCodeGenerator: Generates pseudocode from structured representation