diff --git a/docs/commands/vmmap.md b/docs/commands/vmmap.md index 76e3bc868..73f20b36e 100644 --- a/docs/commands/vmmap.md +++ b/docs/commands/vmmap.md @@ -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) diff --git a/gef.py b/gef.py index ec03cbe99..f99cf2841 100644 --- a/gef.py +++ b/gef.py @@ -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: diff --git a/tests/commands/vmmap.py b/tests/commands/vmmap.py index 50dfeacaa..591d3b387 100644 --- a/tests/commands/vmmap.py +++ b/tests/commands/vmmap.py @@ -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)