Read or write string to memory. Args: addr: source / destination address value: string to write, or None if reading one from memory encoding: string encoding Returns: null-terminated string read from memory, or None if wrote one
(self, addr: int, value=None, encoding='utf-8')
| 106 | # TODO: this is an obsolete utility method that should not be used anymore |
| 107 | # and here for backward compatibility. use QlOsUtils.read_cstring instead |
| 108 | def string(self, addr: int, value=None, encoding='utf-8') -> Optional[str]: |
| 109 | """Read or write string to memory. |
| 110 | |
| 111 | Args: |
| 112 | addr: source / destination address |
| 113 | value: string to write, or None if reading one from memory |
| 114 | encoding: string encoding |
| 115 | |
| 116 | Returns: null-terminated string read from memory, or None if wrote one |
| 117 | """ |
| 118 | |
| 119 | if value is None: |
| 120 | return self.__read_string(addr) |
| 121 | |
| 122 | self.__write_string(addr, value, encoding) |
| 123 | |
| 124 | def add_mapinfo(self, mem_s: int, mem_e: int, mem_p: int, mem_info: str, mmio_ctx: Optional[QlMmioHandler] = None): |
| 125 | """Add a new memory range to map. |