(self, absolute_address, target_region_id=None)
return descriptor.region_id, absolute_address - base_address, descriptor.related_function_address
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.

        :param absolute_address:    An absolute memory address
        :return:                    A tuple of the closest region ID, the relative offset, and the related function
                                    address.
Convert an absolute address to the memory offset in a memory region.
Convert an absolute address to the memory offset in a memory region .
def relativize(self, 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.

        :param absolute_address:    An absolute memory address
        :return:                    A tuple of the closest region ID, the relative offset, and the related function
                                    address.
        """

        if target_region_id is None:
            if self.is_stack:
                # Get the base address of the stack frame it belongs to
                base_address = next(self._address_to_region_id.irange(minimum=absolute_address, reverse=False))

            else:
                try:
                    base_address = next(self._address_to_region_id.irange(maximum=absolute_address, reverse=True))

                except StopIteration:
                    # Not found. It belongs to the global region then.
                    return 'global', absolute_address, None

            descriptor = self._address_to_region_id[base_address]

        else:
            if target_region_id == 'global':
                # Just return the absolute address
                return 'global', absolute_address, None

            if target_region_id not in self._region_id_to_address:
                raise SimRegionMapError('Trying to relativize to a non-existent region "%s"' % target_region_id)

            descriptor = self._region_id_to_address[target_region_id]
            base_address = descriptor.base_address

        return descriptor.region_id, absolute_address - base_address, descriptor.related_function_address
def relativize ( self , absolute_address , target_region_id = None ) : if target_region_id is None : if self . is_stack : # Get the base address of the stack frame it belongs to base_address = next ( self . _address_to_region_id . irange ( minimum = absolute_address , reverse = False ) ) else : try : base_address = next ( self . _address_to_region_id . irange ( maximum = absolute_address , reverse = True ) ) except StopIteration : # Not found. It belongs to the global region then. return 'global' , absolute_address , None descriptor = self . _address_to_region_id [ base_address ] else : if target_region_id == 'global' : # Just return the absolute address return 'global' , absolute_address , None if target_region_id not in self . _region_id_to_address : raise SimRegionMapError ( 'Trying to relativize to a non-existent region "%s"' % target_region_id ) descriptor = self . _region_id_to_address [ target_region_id ] base_address = descriptor . base_address return descriptor . region_id , absolute_address - base_address , descriptor . related_function_address