aboutsummaryrefslogtreecommitdiff
path: root/lldb/test/API/source-manager/TestSourceManager.py
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/test/API/source-manager/TestSourceManager.py')
-rw-r--r--lldb/test/API/source-manager/TestSourceManager.py19
1 files changed, 14 insertions, 5 deletions
diff --git a/lldb/test/API/source-manager/TestSourceManager.py b/lldb/test/API/source-manager/TestSourceManager.py
index ad7c85a..7071f09 100644
--- a/lldb/test/API/source-manager/TestSourceManager.py
+++ b/lldb/test/API/source-manager/TestSourceManager.py
@@ -314,19 +314,28 @@ class SourceManagerTestCase(TestBase):
)
def test_artificial_source_location(self):
- src_file = "artificial_location.c"
- d = {"C_SOURCES": src_file}
+ src_file = "artificial_location.cpp"
+ d = {"C_SOURCES": "", "CXX_SOURCES": src_file}
self.build(dictionary=d)
- lldbutil.run_to_source_breakpoint(
- self, "main", lldb.SBFileSpec(src_file, False)
- )
+ target = lldbutil.run_to_breakpoint_make_target(self)
+
+ # Find the instruction with line=0 and put a breakpoint there.
+ sc_list = target.FindFunctions("A::foo")
+ self.assertEqual(len(sc_list), 1)
+ insns = sc_list[0].function.GetInstructions(target)
+ insn0 = next(filter(lambda insn: insn.addr.line_entry.line == 0, insns))
+ bkpt = target.BreakpointCreateBySBAddress(insn0.addr)
+ self.assertGreater(bkpt.GetNumLocations(), 0)
+
+ lldbutil.run_to_breakpoint_do_run(self, target, bkpt)
self.expect(
"process status",
substrs=[
"stop reason = breakpoint",
f"{src_file}:0",
+ "static int foo();",
"Note: this address is compiler-generated code in function",
"that has no source code associated with it.",
],