angr.storage.memory_mixins.memory_mixin

class angr.storage.memory_mixins.memory_mixin.MemoryMixin

Bases: SimStatePlugin, Generic

MemoryMixin is the base class for the memory model in angr. It provides a set of methods that should be implemented by memory models. This is done using mixins, where each mixin handles some specific feature of the memory model, only overriding methods that it needs to implement its function. The memory model class itself then combines a set of mixins using inheritence to form the final memory model class.

SUPPORTS_CONCRETE_LOAD: bool = False
__init__(memory_id=None, endness='Iend_BE')
Parameters:
  • memory_id (str | None)

  • endness (str)

property category: str

reg, mem, or file.

Type:

Return the category of this SimMemory instance. It can be one of the three following categories

property variable_key_prefix: tuple[Any, ...]
find(addr, data, max_search, **kwargs)
Return type:

tuple[TypeVar(Addr), list[Bool], list[int]]

Parameters:
  • addr (Addr)

  • data (InData)

  • max_search (int)

load(addr, size=None, **kwargs)
Return type:

TypeVar(OutData)

Parameters:
  • addr (Addr)

  • size (InData | None)

store(addr, data, size=None, **kwargs)
Return type:

None

Parameters:
  • addr (Addr)

  • data (InData)

  • size (InData | None)

compare(other)
Return type:

bool

Parameters:

other (Self)

permissions(addr, permissions=None, **kwargs)
Return type:

BV

Parameters:
map_region(addr, length, permissions, *, init_zero=False, **kwargs)
Parameters:
unmap_region(addr, length, **kwargs)
Parameters:
  • addr (Addr)

  • length (int)

concrete_load(addr, size, writing=False, **kwargs)

Set SUPPORTS_CONCRETE_LOAD to True and implement concrete_load if reading concrete bytes is faster in this memory model.

Parameters:
  • addr – The address to load from.

  • size – Size of the memory read.

  • writing

Return type:

Any

Returns:

A memoryview into the loaded bytes.

erase(addr, size=None, **kwargs)

Set [addr:addr+size) to uninitialized. In many cases this will be faster than overwriting those locations with new values. This is commonly used during static data flow analysis.

Parameters:
  • addr (TypeVar(Addr)) – The address to start erasing.

  • size (int | None) – The number of bytes for erasing.

Return type:

None

Returns:

None

replace_all(old, new)
Parameters:
copy_contents(dst, src, size, condition=None, **kwargs)

Override this method to provide faster copying of large chunks of data.

Parameters:
  • dst (TypeVar(Addr)) – The destination of copying.

  • src (TypeVar(Addr)) – The source of copying.

  • size (TypeVar(InData)) – The size of copying.

  • condition (Bool | None) – The storing condition.

  • kwargs – Other parameters.

Returns:

None