add try except around search memory

pull/1872/head
Aaron Adams 2 years ago committed by Disconnect3d
parent 2441ae9402
commit 0fbe6cf47f

@ -58,7 +58,21 @@ def search(searchfor, mappings=None, start=None, end=None, executable=False, wri
if length <= 0:
break
start = i.search_memory(start, length, searchfor)
try:
start = i.search_memory(start, length, searchfor)
except gdb.error as e:
# While remote debugging on an embedded device and searching
# through a large memory region (~512mb), gdb may return an error similar
# to `error: Invalid hex digit 116`, even though the search
# itself is ok. It seems to have to do with a timeout.
print(f"WARN: gdb.search_memory failed with: {e}")
if e.args[0].startswith("Invalid hex digit"):
print(
"WARN: This is possibly related to a timeout. Connection is likely broken."
)
break
start = None
pass
if start is None:
break

Loading…
Cancel
Save