Skip to content

Commit

Permalink
Add tests for -n and -a
Browse files Browse the repository at this point in the history
  • Loading branch information
ValekoZ committed Sep 25, 2024
1 parent e9b45bc commit 3da17fe
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions tests/commands/vmmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,34 @@ def test_cmd_vmmap(self):
)
gdb.execute("start")
res = gdb.execute("vmmap", to_string=True)
self.assertGreater(len(res.splitlines()), 1)
self.assertEqual(len(res.splitlines()), 23)

res = gdb.execute("vmmap stack", to_string=True)
self.assertGreater(len(res.splitlines()), 1)
assert "`stack` has no type specified. We guessed it was a name filter." in res
self.assertEqual(len(res.splitlines()), 9)

res = gdb.execute("vmmap $pc", to_string=True)
assert "`$pc` has no type specified. We guessed it was an address filter." in res
self.assertEqual(len(res.splitlines()), 8)

def test_cmd_vmmap_addr(self):
gef, gdb = self._gef, self._gdb
gdb.execute("start")

pc = gef.arch.register("pc")

res = gdb.execute(f"vmmap -a {pc:#x}", to_string=True)
self.assertEqual(len(res.splitlines()), 5)

res = gdb.execute("vmmap --addr $pc", to_string=True)
self.assertEqual(len(res.splitlines()), 5)

def test_cmd_vmmap_name(self):
gdb = self._gdb
gdb.execute("start")

res = gdb.execute("vmmap -n stack", to_string=True)
self.assertEqual(len(res.splitlines()), 5)

res = gdb.execute("vmmap --name stack", to_string=True)
self.assertEqual(len(res.splitlines()), 5)

0 comments on commit 3da17fe

Please sign in to comment.