2 from lldbsuite.test.decorators import *
3 from lldbsuite.test.lldbtest import *
4 from lldbsuite.test import lldbutil
6 class TestCppIncompleteTypes(TestBase):
8 mydir = TestBase.compute_mydir(__file__)
10 @skipIf(compiler="gcc")
11 def test_limit_debug_info(self):
13 frame = self.get_test_frame('limit')
15 value_f = frame.EvaluateExpression("f")
16 self.assertTrue(value_f.IsValid(), "'expr f' results in a valid SBValue object")
17 self.assertTrue(value_f.GetError().Success(), "'expr f' is successful")
19 value_a = frame.EvaluateExpression("a")
20 self.assertTrue(value_a.IsValid(), "'expr a' results in a valid SBValue object")
21 self.assertTrue(value_a.GetError().Success(), "'expr a' is successful")
23 @skipIf(compiler="gcc")
24 @skipIfWindows # Clang on Windows asserts in external record layout in this case.
25 def test_partial_limit_debug_info(self):
27 frame = self.get_test_frame('nolimit')
29 value_f = frame.EvaluateExpression("f")
30 self.assertTrue(value_f.IsValid(), "'expr f' results in a valid SBValue object")
31 self.assertTrue(value_f.GetError().Success(), "'expr f' is successful")
33 value_a = frame.EvaluateExpression("a")
34 self.assertTrue(value_a.IsValid(), "'expr a' results in a valid SBValue object")
35 self.assertTrue(value_a.GetError().Success(), "'expr a' is successful")
37 def get_test_frame(self, exe):
38 # Get main source file
40 src_file_spec = lldb.SBFileSpec(src_file)
41 self.assertTrue(src_file_spec.IsValid(), "Main source file")
43 # Get the path of the executable
45 exe_path = os.path.join(cwd, exe)
48 target = self.dbg.CreateTarget(exe_path)
49 self.assertTrue(target.IsValid(), VALID_TARGET)
51 # Break on main function
52 main_breakpoint = target.BreakpointCreateBySourceRegex("break here", src_file_spec)
53 self.assertTrue(main_breakpoint.IsValid() and main_breakpoint.GetNumLocations() >= 1, VALID_BREAKPOINT)
58 process = target.LaunchSimple(args, env, self.get_process_working_directory())
59 self.assertTrue(process.IsValid(), PROCESS_IS_VALID)
61 # Get the thread of the process
62 self.assertTrue(process.GetState() == lldb.eStateStopped, PROCESS_STOPPED)
63 thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
65 # Get frame for current thread
66 return thread.GetSelectedFrame()