angr.storage.memory_mixins.regioned_memory.regioned_memory_mixin¶
- class angr.storage.memory_mixins.regioned_memory.regioned_memory_mixin.RegionedMemoryMixin¶
Bases:
MemoryMixinRegioned memory. This mixin manages multiple memory regions. Each address is represented as a tuple of (region ID, offset into the region), which is called a regioned address.
Converting absolute addresses into regioned addresses: We map an absolute address to a region by looking up which region this address belongs to in the region map. Currently this is only enabled for stack. Heap support has not landed yet.
When start analyzing a function, the user should call set_stack_address_mapping() to create a new region mapping. Likewise, when exiting from a function, the user should cancel the previous mapping by calling unset_stack_address_mapping().
- __init__(write_targets_limit=2048, read_targets_limit=4096, stack_region_map=None, generic_region_map=None, stack_size=65536, cle_memory_backer=None, dict_memory_backer=None, regioned_memory_cls=None, **kwargs)¶
- load(addr, size=None, *, endness=None, condition=None, **kwargs)¶
- set_stack_address_mapping(absolute_address, region_id, related_function_address=None)¶
Create a new mapping between an absolute address (which is the base address of a specific stack frame) and a region ID.
- unset_stack_address_mapping(absolute_address)¶
Remove a stack mapping.
- Parameters:
absolute_address (
int) – An absolute memory address that is the base address of the stack frame to destroy.
- stack_id(function_address)¶
Return a memory region ID for a function. If the default region ID exists in the region mapping, an integer will appended to the region name. In this way we can handle recursive function calls, or a function that appears more than once in the call frame.
This also means that stack_id() should only be called when creating a new stack frame for a function. You are not supposed to call this function every time you want to map a function address to a stack ID.