Skip to content

Commit

Permalink
allow mock mem layout for old qemu versions
Browse files Browse the repository at this point in the history
  • Loading branch information
hugsy committed Nov 7, 2024
1 parent 8130895 commit 7973a3f
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions gef.py
Original file line number Diff line number Diff line change
Expand Up @@ -10859,16 +10859,32 @@ def __parse_maps(self) -> list[Section] | None:

try:
return list(self.parse_gdb_info_proc_maps())
except Exception:
pass
except Exception as e:
dbg(f"parse_gdb_info_proc_maps() failed, reason: {str(e)}")

try:
return list(self.parse_procfs_maps())
except Exception:
pass
except Exception as e:
dbg(f"parse_procfs_maps() failed, reason: {str(e)}")

try:
return list(self.parse_monitor_info_mem())
except Exception as e:
dbg(f"parse_monitor_info_mem() failed, reason: {str(e)}")

try:
# as a very last resort, use a mock rwx memory layout only if a session is running
assert gef.binary and gef.session.pid
warn("Could not determine memory layout accurately, using mock layout")
fname = gef.binary.path
if is_32bit():
page_start, page_end = 0x00000000, 0xffffffff
else:
page_start, page_end = 0x0000000000000000, 0xffffffffffffffff
return [Section(page_start=page_start,
page_end=page_end,
permission = Permission.ALL,
path = str(fname)),]
except Exception:
pass

Expand Down

0 comments on commit 7973a3f

Please sign in to comment.