angr.analyses.reaching_definitions.rd_state

class angr.analyses.reaching_definitions.rd_state.ReachingDefinitionsState

Bases: object

Represents the internal state of the ReachingDefinitionsAnalysis.

It contains a data class LiveDefinitions, which stores both definitions and uses for register, stack, memory, and temporary variables, uncovered during the analysis.

Parameters:
  • subject (Subject) – The subject being analyzed.

  • track_tmps (bool) – Only tells whether or not temporary variables should be taken into consideration when representing the state of the analysis. Should be set to true when the analysis has counted uses and definitions for temporary variables, false otherwise.

  • analysis (ReachingDefinitionsAnalysis) – The analysis that generated the state represented by this object.

  • rtoc_value – When the targeted architecture is ppc64, the initial function needs to know the rtoc_value.

  • live_definitions (LiveDefinitions | None)

  • canonical_size (int) – The sizes (in bytes) that objects with an UNKNOWN_SIZE are treated as for operations where sizes are necessary.

  • heap_allocator (HeapAllocator | None) – Mechanism to model the management of heap memory.

  • environment (Environment | None) – Representation of the environment of the analyzed program.

Variables:

arch (Arch) – The architecture targeted by the program.

__init__(codeloc, arch, subject, analysis, track_tmps=False, track_consts=False, rtoc_value=None, live_definitions=None, canonical_size=8, heap_allocator=None, environment=None, sp_adjusted=False, all_definitions=None, initializer=None, element_limit=5, merge_into_tops=True)
Parameters:
codeloc
arch: Arch
analysis
all_definitions: set[Definition[Any, Any]]
heap_allocator
codeloc_uses: set[Definition[Any, Any]]
exit_observed: bool
live_definitions
top(bits)
Parameters:

bits (int)

is_top(*args)
heap_address(offset)
Return type:

BV

Parameters:

offset (int | HeapAddress)

static is_heap_address(addr)
Return type:

bool

Parameters:

addr (Base)

static get_heap_offset(addr)
Return type:

int | None

Parameters:

addr (Base)

stack_address(offset)
Return type:

BV

Parameters:

offset (int)

is_stack_address(addr)
Return type:

bool

Parameters:

addr (Base)

get_stack_offset(addr)
Return type:

int | None

Parameters:

addr (Base)

annotate_with_def(symvar, definition)
Parameters:
Return type:

TypeVar(MVType, bound= BV | FP)

Returns:

annotate_mv_with_def(mv, definition)
Return type:

MultiValues[TypeVar(MVType, bound= BV | FP)]

Parameters:
extract_defs(symvar)
Return type:

Iterator[Definition[Any, Any]]

Parameters:

symvar (Base)

property tmps
property tmp_uses
property registers: MultiValuedMemory
property register_uses
property stack: MultiValuedMemory
property stack_uses
property heap: MultiValuedMemory
property heap_uses
property memory: MultiValuedMemory
property memory_uses
property others: dict[Atom, MultiValues]
property uses_by_codeloc
get_sp()
Return type:

int

get_stack_address(offset)
Return type:

int | None

Parameters:

offset (Base)

property environment
property dep_graph
copy(discard_tmpdefs=False)
Return type:

Self

merge(*others)
Return type:

tuple[Self, bool]

Parameters:

others (Self)

compare(other)
Return type:

bool

Parameters:

other (ReachingDefinitionsState)

move_codelocs(new_codeloc)
Return type:

None

Parameters:

new_codeloc (CodeLocation)

kill_definitions(atom)

Overwrite existing definitions w.r.t ‘atom’ with a dummy definition instance. A dummy definition will not be removed during simplification.

Return type:

None

Parameters:

atom (Atom)

kill_and_add_definition(atom, data, dummy=False, tags=None, endness=None, annotated=False, uses=None, override_codeloc=None)
Return type:

tuple[MultiValues | None, set[Definition[TypeVar(A, bound= Atom), TypeVar(CodeLoc, bound= CodeLocation | AILCodeLocation)]]]

Parameters:
add_use(atom, expr=None)
Return type:

None

Parameters:
add_use_by_def(definition, expr=None)
Return type:

None

Parameters:
add_tmp_use(tmp, expr=None)
Return type:

None

Parameters:
add_tmp_use_by_defs(defs, expr=None)
Return type:

None

Parameters:
add_register_use(reg_offset, size, expr=None)
Return type:

None

Parameters:
  • reg_offset (int)

  • size (int)

  • expr (Any | None)

add_register_use_by_defs(defs, expr=None)
Return type:

None

Parameters:
add_stack_use(stack_offset, size, expr=None)
Return type:

None

Parameters:
  • stack_offset (int)

  • size (int)

  • expr (Any | None)

add_stack_use_by_defs(defs, expr=None)
Parameters:
add_heap_use(heap_offset, size, expr=None)
Return type:

None

Parameters:
  • heap_offset (int)

  • size (int)

  • expr (Any | None)

add_heap_use_by_defs(defs, expr=None)
Parameters:
add_memory_use_by_def(definition, expr=None)
Parameters:
add_memory_use_by_defs(defs, expr=None)
Parameters:
get_definitions(atom)
Return type:

set[Definition[Atom, TypeVar(CodeLoc, bound= CodeLocation | AILCodeLocation)]]

Parameters:

atom (Atom | Definition[Atom, CodeLoc] | Iterable[Atom] | Iterable[Definition[Atom, CodeLoc]] | MultiValues)

get_values(spec)
Return type:

MultiValues | None

Parameters:

spec (A | Definition[A, CodeLoc] | Iterable[A])

get_one_value(spec, strip_annotations=False)
Return type:

BV | None

Parameters:
get_concrete_value(spec, cast_to=<class 'int'>)
Overloads:
  • self, spec (Atom | Definition[Atom, CodeLoc] | Iterable[Atom]), cast_to (type[int]) → int | None

  • self, spec (Atom | Definition[Atom, CodeLoc] | Iterable[Atom]), cast_to (type[bytes]) → bytes | None

Parameters:
Return type:

int | bytes | None

mark_guard(target)
mark_const(value, size)
Parameters:
downsize()
deref(pointer, size, endness=Endness.BE)
Overloads:
  • self, pointer (int | claripy.ast.BV | HeapAddress | SpOffset), size (int | DerefSize), endness (archinfo.Endness) → MemoryLocation | None

  • self, pointer (MultiValues | A | Definition | Iterable[A] | Iterable[Definition[A, CodeLoc]]), size (int | DerefSize), endness (archinfo.Endness) → set[MemoryLocation]

Parameters: