Skip to content

Commit

Permalink
Extend the test for gef.memory.parse_gdb_info_proc_maps()
Browse files Browse the repository at this point in the history
The offsets parsed are now checked against the offsets in
`/proc/PID/maps`.
  • Loading branch information
mjklbhvg committed May 2, 2024
1 parent b72049c commit c7a19f8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests/api/gef_memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,11 @@ def test_api_gef_memory_parse_info_proc_maps(self):
next(root.eval("gef.memory.parse_gdb_info_proc_maps()") )

else:
for section in root.eval("gef.memory.parse_gdb_info_proc_maps()"):
assert isinstance(section, Section)
sections = list(root.eval("gef.memory.parse_gdb_info_proc_maps()"))
with open(f"/proc/{gef.session.pid}/maps") as f:
for section, line in zip(sections, f.read().splitlines()):
assert isinstance(section, Section)
assert section.offset == int(line.split()[2], 16)

def test_func_parse_permissions(self):
root = self._conn.root
Expand Down

0 comments on commit c7a19f8

Please sign in to comment.