Skip to content

Commit

Permalink
Evaluate arguments passed to vmmap
Browse files Browse the repository at this point in the history
  • Loading branch information
clubby789 committed Apr 20, 2024
1 parent d211658 commit 156a9d7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/commands/vmmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ determine which section it belongs to.
![vmmap-grep](https://i.imgur.com/ZFF4QVf.png)

![vmmap-address](https://i.imgur.com/hfcs1jH.png)

The address can be also be given in the form of a register or variable.

![vmmap-register](https://i.imgur.com/RlZA6NU.png)
4 changes: 4 additions & 0 deletions gef.py
Original file line number Diff line number Diff line change
Expand Up @@ -8711,6 +8711,10 @@ def do_invoke(self, argv: List[str]) -> None:
addr = int(argv[0], 0)
if addr >= entry.page_start and addr < entry.page_end:
self.print_entry(entry)
else:
addr = safe_parse_and_eval(argv[0])
if addr is not None and addr >= entry.page_start and addr < entry.page_end:
self.print_entry(entry)
return

def print_entry(self, entry: Section) -> None:
Expand Down
3 changes: 3 additions & 0 deletions tests/commands/vmmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ def test_cmd_vmmap(self):

res = gdb.execute("vmmap stack", to_string=True)
self.assertGreater(len(res.splitlines()), 1)

res = gdb.execute("vmmap $rip", to_string=True)
self.assertEqual(len(res.splitlines()), 2)

0 comments on commit 156a9d7

Please sign in to comment.