angr.keyed_region

class angr.keyed_region.StoredObject

Bases: object

__init__(start, obj, size)
start
obj
size: UnknownSize | int
property obj_id
class angr.keyed_region.RegionObject

Bases: object

Represents one or more objects occupying one or more bytes in KeyedRegion.

__init__(start, size, objects=None)
start
size
stored_objects
property is_empty
property end
property internal_objects
includes(offset)
split(split_at)
add_object(obj)
set_object(obj)
copy()
class angr.keyed_region.KeyedRegion

Bases: object

KeyedRegion keeps a mapping between stack offsets and all objects covering that offset. It assumes no variable in this region overlap with another variable in this region.

Registers and function frames can all be viewed as a keyed region.

__init__(tree=None, phi_node_contains=None, canonical_size=8)
copy()
merge(other, replacements=None)

Merge another KeyedRegion into this KeyedRegion.

Parameters:

other (KeyedRegion) – The other instance to merge with.

Returns:

None

merge_to_top(other, replacements=None, top=None)

Merge another KeyedRegion into this KeyedRegion, but mark all variables with different values as TOP.

Parameters:
  • other – The other instance to merge with.

  • replacements

Returns:

self

replace(replacements)

Replace variables with other variables.

Parameters:

replacements (dict) – A dict of variable replacements.

Returns:

self

dbg_repr()

Get a debugging representation of this keyed region. :return: A string of debugging output.

add_variable(start, variable)

Add a variable to this region at the given offset.

Parameters:
Returns:

None

add_object(start, obj, object_size)

Add/Store an object to this region at the given offset.

Parameters:
  • start

  • obj

  • object_size (int) – Size of the object

Returns:

set_variable(start, variable)

Add a variable to this region at the given offset, and remove all other variables that are fully covered by this variable.

Parameters:
Returns:

None

set_object(start, obj, object_size)

Add an object to this region at the given offset, and remove all other objects that are fully covered by this object.

Parameters:
  • start

  • obj

  • object_size

Returns:

get_base_addr(addr)

Get the base offset (the key we are using to index objects covering the given offset) of a specific offset.

Parameters:

addr (int)

Returns:

Return type:

int or None

get_variables_by_offset(start)

Find variables covering the given region offset.

Parameters:

start (int)

Returns:

A set of variables.

Return type:

set

get_objects_by_offset(start)

Find objects covering the given region offset.

Parameters:

start

Returns:

get_all_variables()

Get all variables covering the current region.

Returns:

A set of all variables.