angr.storage.memory_mixins.regioned_memory.region_data

class angr.storage.memory_mixins.regioned_memory.region_data.AddressWrapper

Bases: object

AddressWrapper is used in SimAbstractMemory, which provides extra meta information for an address (or a ValueSet object) that is normalized from an integer/BVV/StridedInterval.

__init__(region, region_base_addr, address, is_on_stack, function_address)

Constructor for the class AddressWrapper.

Parameters:
  • region (str) – Name of the memory regions it belongs to.

  • region_base_addr (int) – Base address of the memory region

  • address – An address (not a ValueSet object).

  • is_on_stack (bool) – Whether this address is on a stack region or not.

  • function_address (int | None) – Related function address (if any).

region
region_base_addr
address
is_on_stack
function_address
to_valueset(state)

Convert to a ValueSet instance

Parameters:

state – A state

Returns:

The converted ValueSet instance

class angr.storage.memory_mixins.regioned_memory.region_data.RegionDescriptor

Bases: object

Descriptor for a memory region ID.

__init__(region_id, base_address, related_function_address=None)
region_id
base_address
related_function_address
class angr.storage.memory_mixins.regioned_memory.region_data.RegionMap

Bases: object

Mostly used in SimAbstractMemory, RegionMap stores a series of mappings between concrete memory address ranges and memory regions, like stack frames and heap regions.

__init__(is_stack)

Constructor

Parameters:

is_stack – Whether this is a region map for stack frames or not. Different strategies apply for stack regions.

property is_empty
property stack_base
property region_ids
copy(memo)
map(absolute_address, region_id, related_function_address=None)

Add a mapping between an absolute address and a region ID. If this is a stack region map, all stack regions beyond (lower than) this newly added regions will be discarded.

Parameters:
  • absolute_address – An absolute memory address.

  • region_id – ID of the memory region.

  • related_function_address – A related function address, mostly used for stack regions.

unmap_by_address(absolute_address)

Removes a mapping based on its absolute address.

Parameters:

absolute_address – An absolute address

absolutize(region_id, relative_address)

Convert a relative address in some memory region to an absolute address.

Parameters:
  • region_id – The memory region ID

  • relative_address – The relative memory offset in that memory region

Returns:

An absolute address if converted, or an exception is raised when region id does not exist.

relativize(absolute_address, target_region_id=None)

Convert an absolute address to the memory offset in a memory region.

Note that if an address belongs to heap region is passed in to a stack region map, it will be converted to an offset included in the closest stack frame, and vice versa for passing a stack address to a heap region. Therefore you should only pass in address that belongs to the same category (stack or non-stack) of this region map.

Parameters:

absolute_address – An absolute memory address

Returns:

A tuple of the closest region ID, the relative offset, and the related function address.