diff options
Diffstat (limited to 'python')
| -rw-r--r-- | python/binaryview.py | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/python/binaryview.py b/python/binaryview.py index 4b36d05a..b0cabe0c 100644 --- a/python/binaryview.py +++ b/python/binaryview.py @@ -2119,7 +2119,8 @@ class MemoryMap: BinaryView has a view into the MemoryMap which is described by the Segments defined in that BinaryView. The MemoryMap object allows for the addition of multiple, arbitrary overlapping regions of memory. Segmenting of the address space is automatically handled when the MemoryMap is modified and in the case where a portion of the system address space has - multilple defined regions, the default ordering gives priority to the most recently added region. + multilple defined regions, the default ordering gives priority to the most recently added region. This feature is + experimental and under active development. :Example: @@ -2230,19 +2231,33 @@ class MemoryMap: def description(self): return json.loads(core.BNGetMemoryMapDescription(self.handle)) -# // LoadBinary: -# // Loads a file in a loadable binary format. -# // Provides persistence, indicating that the loaded data will persist across sessions. -# // Presumably loads the file into memory according to the virtual and physical load addresses specified in the file itself. -# // LoadFile: -# // Loads a flat file or bytes directly at the specified address. -# // Provides persistence, suggesting that the loaded data will be saved and remain accessible across sessions. -# // Allows for direct loading of files or bytes into memory at a specified location. -# // LoadRemote: -# // Loads data from a remote source or interface. -# // Not persistent, implying that the loaded data is ephemeral and may not be saved across sessions. -# // Supports a target where bytes are provided/generated upon request, indicating a dynamic and potentially transient data source. def add_memory_region(self, name: str, start: int, source: Union['os.PathLike', str, bytes, bytearray, 'BinaryView', 'databuffer.DataBuffer', 'fileaccessor.FileAccessor']) -> bool: + """ + Adds a memory region into the memory map. There are three types of memory regions that can be added: + - BinaryMemoryRegion(*** Unimplemented ***): Creates a memory region from a loadable binary format and provides persistence across sessions. + - DataMemoryRegion: Creates a memory region from a flat file or bytes and provide persistence across sessions. + - RemoteMemoryRegion: Creates a memory region from a proxy callback interface. This region is ephemeral and not saved across sessions. + + The type of memory region added depends on the source parameter: + - `os.PathLike`, `str`, : Treats the source as a file path which is read and loaded into memory as a DataMemoryRegion. + - `bytes`, `bytearray`: Directly loads these byte formats into memory as a DataMemoryRegion. + - `databuffer.DataBuffer`: Directly loads a data buffer into memory as a DataMemoryRegion. + - `fileaccessor.FileAccessor`: Utilizes a file accessor to establish a RemoteMemoryRegion, managing data fetched from a remote source. + + Parameters: + name (str): A unique name of the memory region. + start (int): The start address in memory where the region will be loaded. + source (Union[os.PathLike, str, bytes, bytearray, BinaryView, databuffer.DataBuffer, fileaccessor.FileAccessor]): The source from which the memory is loaded. + + Returns: + bool: True if the memory region was successfully added, False otherwise. + + Raises: + NotImplementedError: If the source type is not supported. + + Notes: + If parts of the new memory region do not overlap with existing segments, new segments will be automatically created for each non-overlapping area, each with the SegmentFlag.SegmentReadable flag set. + """ if isinstance(source, os.PathLike): source = str(source) if isinstance(source, bytes) or isinstance(source, bytearray): |
