angr.analyses.calling_convention.fact_collector

type angr.analyses.calling_convention.fact_collector.FactData = tuple[int, int, int] | None
class angr.analyses.calling_convention.fact_collector.FactCollectorState

Bases: object

The abstract state for FactCollector.

__init__()
tmps: dict[int, FactData]
simple_stack: dict[int, FactData]
simple_regs: dict[int, FactData]
ins_addr
callee_stored_regs: dict[int, int]
reg_reads
reg_reads_count
reg_lane_reads: dict[int, int]

widest scalar (<= 8-byte) lane consumed from an FP argument register, directly or through a full-register copy; it narrows a vector-wide read (movaps xmm6, xmm2) to the width the function actually uses

reg_writes: set[int]
stack_reads
stack_reads_fp
stack_writes: set[int]
pointer_arg_derefs: defaultdict[FactData, int]
pointer_arg_deref_sizes: dict[FactData, int]

widest access through each pointer argument, in bytes

sp_value
bp_value
register_read(offset, size_in_bytes)
Parameters:
  • offset (int)

  • size_in_bytes (int)

register_entry_read(offset, size_in_bytes)

A read of the register’s function-entry value, already known to precede any write to it.

Parameters:
  • offset (int)

  • size_in_bytes (int)

register_lane_read(offset, size_in_bytes)
Parameters:
  • offset (int)

  • size_in_bytes (int)

register_read_undo(offset)
Return type:

None

Parameters:

offset (int)

register_written(offset, size_in_bytes)
Parameters:
  • offset (int)

  • size_in_bytes (int)

stack_read(offset, size_in_bytes, fp=False)
Parameters:
stack_written(offset, size_int_bytes)
Parameters:
  • offset (int)

  • size_int_bytes (int)

copy(with_tmps=True)
Return type:

FactCollectorState

Parameters:

with_tmps (bool)

class angr.analyses.calling_convention.fact_collector.SimEngineFactCollectorVEX

Bases: SimEngineNostmtVEX[FactCollectorState, FactData, None], SimEngineLight[FactCollectorState, FactData, Block, None]

The engine for FactCollector.

__init__(project, bp_as_gpr, track_arg_uses, seen_reg_uses, seen_reg_pushes)
Parameters:
seen_reg_pushes

spills or stack-padding pushes

Type:

stores of a register’s entry value to the stack (push reg)

process(state, *, block=None, whitelist=None, **kwargs)
class angr.analyses.calling_convention.fact_collector.FactCollector

Bases: Analysis

An extremely fast analysis that extracts necessary facts of a function for CallingConventionAnalysis to make decision on the calling convention and prototype of a function.

__init__(func, max_depth=100, track_arg_uses=False, track_arg_passthru=False, flavor=None)
Parameters:
callsites: dict[int, tuple[Function, list[FactData]]]

callsite -> (callee, values passed to each argument of the callee’s prototype, in prototype order)

pushed_arg_callsites: dict[int, tuple[Function, list[FactData]]]

callsite -> (callee without a usable prototype, values pushed to the outgoing stack). positions are not prototype indices.

input_args: list[SimRegArg | SimStackArg] | None
unused_args: list[SimRegArg]
retval_size: int | None
retval_incidental: bool

True when every endpoint’s write to the return register looks like a leftover rather than a return value: the value written is consumed again in the same block (stored, tested, passed on) after the write. A void function whose last instruction happens to load into rax looks exactly like a getter from the outside; this is the one local hint that it is not, and CallingConventionAnalysis only lets call-site evidence demote a prototype to void when it is set.

pointer_arg_derefs: defaultdict[FactData, int]
pointer_arg_deref_sizes: dict[FactData, int]
retval_arg: SimRegArg | None

the input argument register whose entry value is in the return register at every return site (an sret-style hidden result pointer, strcpy’s dest, …), or None

extra_pop: int | None

Number of bytes the callee pops after the return address on the stack, or None if we cannot determine.

MAX_CONTINUATION_DEPTH = 3
MAX_CALLER_SITES = 16