-
-
Notifications
You must be signed in to change notification settings - Fork 50
/
Copy pathgot_audit.py
38 lines (27 loc) · 965 Bytes
/
got_audit.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
"""
`got-audit` command test module
"""
import pytest
from tests.base import RemoteGefUnitTestGeneric
from tests.utils import (
ARCH,
ERROR_INACTIVE_SESSION_MESSAGE,
debug_target,
)
@pytest.mark.skipif(ARCH in ("ppc64le",), reason=f"Skipped for {ARCH}")
class GotAuditCommand(RemoteGefUnitTestGeneric):
"""`got-audit` command test module"""
def setUp(self) -> None:
self._target = debug_target("visualize_heap")
return super().setUp()
def test_cmd_got_audit(self):
gdb = self._gdb
self.assertEqual(ERROR_INACTIVE_SESSION_MESSAGE,gdb.execute("got-audit", to_string=True))
gdb.execute("run")
res = gdb.execute("got-audit", to_string=True)
self.assertIn("malloc", res)
self.assertIn("puts", res)
self.assertIn("/libc", res)
res = gdb.execute("got-audit malloc", to_string=True)
self.assertIn("malloc", res)
self.assertNotIn("puts", res)