xref: /llvm-project/lldb/test/API/commands/target/modules/lookup/TestImageLookupPCExpression.py (revision 2c76e88e9eb284d17cf409851fb01f1d583bb22a)
1"""
2Make sure that "target modules lookup -va $pc" works
3"""
4
5
6import lldb
7import lldbsuite.test.lldbutil as lldbutil
8from lldbsuite.test.lldbtest import *
9
10
11class TestImageLookupPCInC(TestBase):
12    def test_sample_rename_this(self):
13        """There can be many tests in a test case - describe this test here."""
14        self.build()
15        self.main_source_file = lldb.SBFileSpec("main.c")
16        self.sample_test()
17
18    def sample_test(self):
19        """Make sure the address expression resolves to the right function"""
20
21        (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(
22            self, "Set a breakpoint here", self.main_source_file
23        )
24
25        self.expect("target modules lookup -va $pc", substrs=["doSomething"])
26        self.expect("target modules lookup -va $pc+4", substrs=["doSomething"])
27
28