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