GDB-Python-Utils
GDB-Python-Utils copied to clipboard
python3: read_string
https://github.com/crossbowerbt/GDB-Python-Utils/blob/509a91b047251ce3e2153858a4dd3372d40e2ef7/gdb_utils.py#L22
the function read_string cloud be simplied.
def read_string(address, count):
if (address == 0):
return None
try:
buffer = gdb.inferiors()[0].read_memory(address, count)
return buffer.tobytes().decode()
except BaseException as err:
# print(err)
return None