2 Test SBCompileUnit APIs.
6 from lldbsuite
.test
.decorators
import *
7 from lldbsuite
.test
.lldbtest
import *
8 from lldbsuite
.test
import lldbutil
11 class CompileUnitAPITestCase(TestBase
):
13 """Exercise some SBCompileUnit APIs."""
16 (target
, process
, thread
, bkpt
) = lldbutil
.run_to_source_breakpoint(
17 self
, "break here", lldb
.SBFileSpec("main.c")
19 self
.assertTrue(target
, VALID_TARGET
)
20 self
.assertTrue(process
, PROCESS_IS_VALID
)
21 self
.assertTrue(bkpt
and bkpt
.GetNumLocations() == 1, VALID_BREAKPOINT
)
25 "There should be a thread stopped due to breakpoint condition",
27 frame0
= thread
.GetFrameAtIndex(0)
28 line_entry
= frame0
.GetLineEntry()
30 sc_list
= target
.FindCompileUnits(line_entry
.GetFileSpec())
31 self
.assertGreater(sc_list
.GetSize(), 0)
33 main_cu
= sc_list
.compile_units
[0]
34 self
.assertTrue(main_cu
.IsValid(), "Main executable CU is not valid")
37 main_cu
.FindLineEntryIndex(line_entry
, True),
38 main_cu
.FindLineEntryIndex(
39 0, line_entry
.GetLine(), line_entry
.GetFileSpec(), True