class MemoryRange(_Generic[_address.AddressType]):
This class represents a memory range as defined by its address and size.
Class Method | from |
Parses the string and creates the corresponding memory range object if this string is in a valid memory range format. |
Method | __and__ |
Computes the intersection of this range with another of the same address type. |
Method | __contains__ |
Returns whether or not the passed address or range is contained in self. |
Method | __eq__ |
Compares the instance for equality with an object. |
Method | __hash__ |
Returns the hash for this value. |
Method | __init__ |
Initializes a MemoryRange |
Method | __iter__ |
Returns an iterator over all addresses in the range. |
Method | __len__ |
Returns the size of this memory range, which is at least 1 (empty ranges are not allowed). |
Method | __ne__ |
Compares the instance for equality with an object. |
Method | __or__ |
Computes the union of this range with another of the same address type. |
Method | __repr__ |
Returns the "official" string representation of this instance. |
Method | __str__ |
Returns the nicely printable string representation of this instance. |
Method | __sub__ |
Computes the difference of this range with another of the same address type. |
Method | difference |
Computes the difference of this range with another of the same address type. |
Method | format |
This method gets an html formatting string representation for this class instance. |
Method | intersection |
Computes the intersection of this range with another of the same address type. |
Method | isdisjoint |
Returns whether or not there exists no element contained both in self and in other. |
Method | issubset |
Returns whether or not all elements of self are contained in other. |
Method | issuperset |
Returns whether or not all elements of other are contained in self. |
Method | translate |
Translates this memory range into the corresponding physical memory ranges. |
Method | union |
Computes the union of this range with another of the same address type. |
Property | address |
Property: The start address of the memory range. |
Property | begin |
Property: The first address in the memory range. |
Property | end |
Property: The first address not contained in the memory range. |
Property | first |
Property: The first address in the memory range. |
Property | last |
Property: The last address in the memory range. |
Property | size |
Property: The size of the memory range. |
Class Method | _parse |
Attempts to parse the string as a memory range. |
Method | _repr |
Representation used by Jupyter Notebook when an instance of a memory range is displayed in a cell. |
Instance Variable | _address |
Undocumented |
Instance Variable | _size |
Undocumented |
def from_string(cls, memory_range_str):
Parses the string and creates the corresponding memory range object if this string is in a valid memory range format.
Information
Parameters | |
memorystr | string in the memory range format (eg. [ds:0xffff89754; 3]) |
Returns | |
MemoryRange | Undocumented |
Raises | |
ValueError | if the provided string cannot be parsed. |
Computes the intersection of this range with another of the same address type.
The intersection is defined as the biggest subrange that is both contained in self and in other.
If such range would be empty, None is returned.
Parameters | |
other:_Optional[ | Undocumented |
Returns | |
_Optional[ | Undocumented |
Returns whether or not the passed address or range is contained in self.
A range is considered as contained in another if it is a subset of that other range.
Parameters | |
x:_Union[ | Undocumented |
Returns | |
bool | Undocumented |
Compares the instance for equality with an object.
- if the object is not a
MemoryRange
, will return False.
Returns | |
bool | Undocumented |
Initializes a MemoryRange
Information
Parameters | |
address:_address.AddressType | The beginning address of the memory range. |
size:int | The size of the memory range. |
Raises | |
ValueError | if size <= 0. |
Returns an iterator over all addresses in the range.
Returns | |
_Iterator[ | Undocumented |
Returns the size of this memory range, which is at least 1 (empty ranges are not allowed).
Returns | |
int | Undocumented |
Compares the instance for equality with an object.
- if the object is not a
MemoryRange
, will return True.
Returns | |
bool | Undocumented |
Computes the union of this range with another of the same address type.
The union is defined as the smallest range that contains both self and other, but no other element.
If self and other are disjoint and not contiguous, then None is returned.
Parameters | |
other:_Optional[ | Undocumented |
Returns | |
_Optional[ | Undocumented |
Returns the "official" string representation of this instance.
Returns | |
str | Undocumented |
Returns the nicely printable string representation of this instance.
Returns | |
str | Undocumented |
Computes the difference of this range with another of the same address type.
The difference is defined as a pair of ranges such that:
- The first range contains all elements of self that are before the first element of other.
- The second range contains all elements of self that are after the last element of other.
If any of these ranges would be empty, then None is returned in its stead.
Parameters | |
other:_Optional[ | Undocumented |
Returns | |
_Tuple[ | Undocumented |
Computes the difference of this range with another of the same address type.
The difference is defined as a pair of ranges such that:
- The first range contains all elements of self that are before the first element of other.
- The second range contains all elements of self that are after the last element of other.
If any of these ranges would be empty, then None is returned in its stead.
Parameters | |
other:_Optional[ | Undocumented |
Returns | |
_Tuple[ | Undocumented |
This method gets an html formatting string representation for this class instance.
Returns | |
str | Undocumented |
Computes the intersection of this range with another of the same address type.
The intersection is defined as the biggest subrange that is both contained in self and in other.
If such range would be empty, None is returned.
Parameters | |
other:_Optional[ | Undocumented |
Returns | |
_Optional[ | Undocumented |
Returns whether or not there exists no element contained both in self and in other.
Parameters | |
other:MemoryRange[ | Undocumented |
Returns | |
bool | Undocumented |
Returns whether or not all elements of self are contained in other.
Parameters | |
other:MemoryRange[ | Undocumented |
Returns | |
bool | Undocumented |
Returns whether or not all elements of other are contained in self.
Parameters | |
other:MemoryRange[ | Undocumented |
Returns | |
bool | Undocumented |
Translates this memory range into the corresponding physical memory ranges.
If self is already a physical memory range, it will be yielded without a translation.
Otherwise this virtual memory range will be translated to its corresponding physical range at the provided context.
Note that a single contiguous virtual memory range can be mapped to multiple non-contiguous physical memory ranges.
Information
Parameters | |
context:_Context | is the context used to translate a virtual range. |
Returns | |
_Iterator[ | Undocumented |
Raises | |
RuntimeError | if the memory range is not fully mapped at the specified context. |
Computes the union of this range with another of the same address type.
The union is defined as the smallest range that contains both self and other, but no other element.
If self and other are disjoint and not contiguous, then None is returned.
Parameters | |
other:_Optional[ | Undocumented |
Returns | |
_Optional[ | Undocumented |
end:
_address.AddressType
=
Property: The first address not contained in the memory range.
def _parse_memory_range(cls, memory_range):
Attempts to parse the string as a memory range.
The expected memory range form is [(segment_reg/phy/lin/segment_index):offset; size]
Parameters | |
memorystr | Undocumented |
Returns | |
MemoryRange | Undocumented |
Raises | |
ValueError | if the passed string cannot be parsed as a memory range |
Representation used by Jupyter Notebook when an instance of a memory range is displayed in a cell.
The range contains a clickable link containing the address string, that publishes the address to all tracked reven2.session.Sessions
.
Returns | |
str | Undocumented |