angr.state_plugins.history

class angr.state_plugins.history.SimStateHistory

Bases: SimStatePlugin

This class keeps track of historically-relevant information for paths.

STRONGREF_STATE = True
__init__(parent=None, clone=None)
jump_guard: BV | None
jumpkind: str | None
edge_hitmap: bytes | None
set_strongref_state(state)
property addr
trim()

Discard the ancestry of this state.

filter_actions(start_block_addr=None, end_block_addr=None, block_stmt=None, insn_addr=None, read_from=None, write_to=None)

Filter self.actions based on some common parameters.

[start_block_addr, end_block_addr]

Parameters:
  • start_block_addr – Only return actions generated in blocks starting at this address.

  • end_block_addr – Only return actions generated in blocks ending at this address.

  • block_stmt – Only return actions generated in the nth statement of each block.

  • insn_addr – Only return actions generated in the assembly instruction at this address.

  • read_from – Only return actions that perform a read from the specified location.

  • write_to – Only return actions that perform a write to the specified location.

Notes: If IR optimization is turned on, reads and writes may not occur in the instruction they originally came from. Most commonly, If a register is read from twice in the same block, the second read will not happen, instead reusing the temp the value is already stored in.

Valid values for read_from and write_to are the string literals ‘reg’ or ‘mem’ (matching any read or write to registers or memory, respectively), any string (representing a read or write to the named register), and any integer (representing a read or write to the memory at this address).

demote()

Demotes this history node, causing it to drop the strong state reference.

reachable()
add_event(event_type, **kwargs)
add_action(action)
extend_actions(new_actions)
subscribe_actions()
property recent_constraints
property recent_actions
property block_count
property lineage
property parents
property events: Reversible[SimEvent]
property actions: Reversible[SimAction]
property jumpkinds: Reversible[str]
property jump_guards: Reversible[Bool]
property jump_targets
property jump_sources
property descriptions: Reversible[str]
property bbl_addrs: Reversible[int]
property ins_addrs: Reversible[int]
property stack_actions
property last_edge_hitmap: bytes | None

Returns the last edge hitmap in the history chain, or None if there is no edge hitmap.

closest_common_ancestor(other)

Find the common ancestor between this history node and ‘other’.

Parameters:

other – the PathHistory to find a common ancestor with.

Returns:

the common ancestor SimStateHistory, or None if there isn’t one

constraints_since(other)

Returns the constraints that have been accumulated since other.

Parameters:

other – a prior PathHistory object

Returns:

a list of constraints

make_child()
class angr.state_plugins.history.TreeIter

Bases: object

__init__(start, end=None)
property hardcopy
count(v)

Count occurrences of value v in the entire history. Note that the subclass must implement the __reversed__ method, otherwise an exception will be thrown. :type object v: :param object v: The value to look for :return: The number of occurrences :rtype: int

class angr.state_plugins.history.HistoryIter

Bases: TreeIter

class angr.state_plugins.history.LambdaAttrIter

Bases: TreeIter

__init__(start, f, **kwargs)
class angr.state_plugins.history.LambdaIterIter

Bases: LambdaAttrIter

__init__(start, f, reverse=True, **kwargs)