GDB-Python-Utils icon indicating copy to clipboard operation
GDB-Python-Utils copied to clipboard

python3: read_string

Open Jamlee opened this issue 3 years ago • 0 comments

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

Jamlee avatar Jan 29 '22 11:01 Jamlee