angr.analyses.decompiler.variable_map¶
- angr.analyses.decompiler.variable_map.variable_map_of(manager)¶
Return the
VariableMapattached to an ailmentManager, lazily creating and attaching an empty one if the manager does not have a map yet (e.g. Managers constructed outside of Clinic in tests). This keeps consumers that reach the map throughmanager.variable_mapfrom having to special-caseNone.- Return type:
- Parameters:
manager (Manager)
- class angr.analyses.decompiler.variable_map.VariableMap¶
Bases:
objectA side container that maps the
.idxof AILStatementandExpressionobjects to variable-related information.The following pieces of information are tracked:
variable(aSimVariable) andvariable_offset(anint): the variable that an AIL atom resolves to, and the offset into that variable.custom_string(abool): whether aConstexpression refers to a custom string.reference_values(adictmappingSimTypeto a value): reference values associated with aConstexpression (e.g., custom strings).reference_variable(aSimVariable) andreference_variable_offset(anint): the variable that a constant expression references, and the offset into it. These are siblings ofvariable/variable_offsetthat are specifically used for constants that reference global/extern variables.
Keys are the integer
.idxvalues of AIL Statement/Expression objects. BecauseClinicbuilds oneailment.Managerper invocation,.idxvalues are unique within a single Clinic. So a VariableMap is scoped to one Clinic instance and is stored in the correspondingDecompilationCache.- __init__()¶
- variable(obj)¶
- Return type:
- Parameters:
obj (TaggedObject | int)
- variable_offset(obj)¶
- Return type:
- Parameters:
obj (TaggedObject | int)
- custom_string(obj)¶
- Return type:
- Parameters:
obj (TaggedObject | int)
- reference_variable(obj)¶
- Return type:
- Parameters:
obj (TaggedObject | int)
- reference_variable_offset(obj)¶
- Return type:
- Parameters:
obj (TaggedObject | int)
- has_variable(obj)¶
- Return type:
- Parameters:
obj (TaggedObject | int)
- set_variable(obj, variable, offset=0)¶
Set the variable information for an AIL atom. If
variableisNone, the variable information for this atom is cleared.- Return type:
- Parameters:
obj (TaggedObject | int)
variable (SimVariable | None)
offset (int)
- set_variable_offset(obj, offset)¶
- Return type:
- Parameters:
obj (TaggedObject | int)
offset (int)
- set_custom_string(obj, value=True)¶
- Return type:
- Parameters:
obj (TaggedObject | int)
value (bool)
- set_reference_values(obj, reference_values)¶
- set_reference_variable(obj, variable, offset=0)¶
Set the reference variable information for an AIL atom. If
variableisNone, the reference variable information for this atom is cleared.- Return type:
- Parameters:
obj (TaggedObject | int)
variable (SimVariable | None)
offset (int)
- transfer(src, dst)¶
Copy all variable information associated with
srctodst. Used when an AIL atom is deep-copied to a new.idx(e.g. during structuring/duplication) so that the new atom keeps the same variable association.- Return type:
- Parameters:
src (TaggedObject | int)
dst (TaggedObject | int)
- to_json()¶
Serialize this VariableMap to a JSON-compatible object.
Variables are referenced by their
.ident(reference-by-ident); they must be resolved back toSimVariableobjects via a resolver infrom_json().