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.
DDG (Data Dependence Graph) analysis is a fast data dependence graph directly generated from CFG analysis results. It tracks simple data dependencies through register and memory accesses.
Constructor
Control flow graph. Must have
keep_state=True and state options including angr.options.refs to store memory, register, and temporary value accesses.An address specifying where to start the generation of this data dependence graph. Defaults to the project entry point.
A non-negative integer specifying how deep to track in the call tree.
None disables call depth limit.A collection of block addresses that the DDG analysis should be performed on. If
None, all blocks are analyzed.Required CFG Configuration
The DDG analysis requires a CFGEmulated with specific configuration:Properties
A NetworkX DiGraph representing the dependence relations between statements. Nodes are
CodeLocation objects.The data dependence graph. Nodes are
ProgramVariable objects representing variables at specific code locations.A simplified version of the data graph with transitive dependencies removed.
A mapping of
ProgramVariable objects to AST representations.A high-level view interface for querying the data dependence graph.
A view interface using the simplified data graph.
Methods
pp()
Pretty print the data dependence graph.get_predecessors(code_location)
Get all predecessors of a code location in the DDG.The code location to query.
CodeLocation objects.
function_dependency_graph(func)
Get a dependency graph for a specific function.The
Function object from the CFG function manager.networkx.DiGraph instance representing dependencies within the function, or None if not found.
data_sub_graph(pv, simplified=True, killing_edges=False, excluding_types=None)
Get a subgraph from the data graph starting from a program variable.The starting program variable.
When
True, use the simplified data graph; otherwise use the full data graph.Whether to include killing edges (overwrite dependencies).
Edge types to exclude from the subgraph.
networkx.MultiDiGraph subgraph.
Example Usage
Basic DDG Analysis
Exploring Dependencies
Using the View Interface
Register Access Tracking
Function-Specific Analysis
Working with ProgramVariable
Limiting Analysis Scope
Call Depth Control
Data Structures
ProgramVariable
Represents a variable at a specific program location.The variable (register, memory, stack, etc.).
The code location where this variable is defined/used.
Whether this is an initial value (e.g., function argument).
DDGViewItem
Provides a high-level interface to query dependencies.List of items this variable depends on.
List of items that depend on this variable.
Tracked Dependencies
The DDG tracks the following types of dependencies:- Temporary variable dependencies (within basic blocks)
- Register dependencies (across instructions)
- Stack read/write dependencies (intra- and inter-function)
- Static memory positions (global data)
Dependency Edge Types
Memory address dependency (used in address calculation).
Memory data dependency (value stored/loaded).
Register dependency.
Temporary variable dependency.
Kill edge (variable overwritten).