angr.analyses.decompiler.edits.resolve

Resolution helpers shared by every edit operation: address-or-name to Function, and pseudocode display name to the underlying SimVariable.

angr.analyses.decompiler.edits.resolve.parse_address(value)

Parse an address given as an int or a string. Accepts 0x-prefixed hex and decimal.

Return type:

int

Parameters:

value (str | int)

angr.analyses.decompiler.edits.resolve.validate_name(name, *, strict=True)

Reject names that cannot be used as identifiers.

strict requires a C identifier. Without it only whitespace-free names are required, which still admits things like int; that render as uncompilable C – so strict is the default.

Return type:

None

Parameters:
angr.analyses.decompiler.edits.resolve.resolve_function(kb, *, address=None, name=None, containing=True)

Find a function by address or by name.

Parameters:
  • containing (bool) – If True, an address inside a function resolves to that function rather than requiring the exact entry address.

  • kb (KnowledgeBase)

  • address (str | int | None)

  • name (str | None)

Return type:

Function

class angr.analyses.decompiler.edits.resolve.ResolvedVariable

Bases: object

A pseudocode display name resolved to the objects an edit needs.

variable is the concrete/SSA variable that set_variable_type expects; unified is the unified variable that a rename mutates (None for globals, which have no unified form).

kind: Literal['argument', 'local', 'global']
variable: SimVariable
unified: SimVariable | None
cvar: CVariable | None = None
arg_index: int | None = None
stack_offset: int | None = None
global_addr: int | None = None
ambiguous: bool = False
property name: str | None
property storage: str
detail()
Return type:

dict

__init__(kind, variable, unified, cvar=None, arg_index=None, stack_offset=None, global_addr=None, ambiguous=False)
Parameters:
Return type:

None

angr.analyses.decompiler.edits.resolve.concrete_variables(varman, resolved)

Every SSA variable sharing the resolved variable’s unified form.

Retyping applies to all of them. Computed here rather than relying on set_variable_type(all_unified=True), which silently does nothing when the variable it is handed is not a key in the SSA-to-unified map.

Return type:

list[SimVariable]

Parameters:

resolved (ResolvedVariable)

angr.analyses.decompiler.edits.resolve.list_variable_names(codegen, kb=None, func_addr=None)

Every display name addressable in this decompilation, for error messages.

Return type:

list[str]

Parameters:
angr.analyses.decompiler.edits.resolve.resolve_variable(kb, func_addr, display_name, *, codegen=None, flavor='pseudocode')

Resolve a name as it appears in the pseudocode to the underlying variable.

Precedence is argument > local > global. A name matching more than one variable within the same bucket resolves deterministically and sets ambiguous, rather than failing – a batch edit should be able to report the collision and continue.

Return type:

ResolvedVariable

Parameters: