2 from lldbsuite.test.decorators import *
3 from lldbsuite.test.lldbtest import *
4 from lldbsuite.test import lldbutil
6 class TestWithLimitDebugInfo(TestBase):
8 mydir = TestBase.compute_mydir(__file__)
10 @skipIf(debug_info=no_match(["dwarf"]))
11 def test_limit_debug_info(self):
16 src_file = os.path.join(cwd, "main.cpp")
17 src_file_spec = lldb.SBFileSpec(src_file)
18 self.assertTrue(src_file_spec.IsValid(), "breakpoint file")
20 # Get the path of the executable
21 exe_path = os.path.join(cwd, 'a.out')
24 target = self.dbg.CreateTarget(exe_path)
25 self.assertTrue(target.IsValid(), VALID_TARGET)
27 # Break on main function
28 breakpoint = target.BreakpointCreateBySourceRegex("break here", src_file_spec)
29 self.assertTrue(breakpoint.IsValid() and breakpoint.GetNumLocations() >= 1, VALID_BREAKPOINT)
32 process = target.LaunchSimple(None, None, self.get_process_working_directory())
33 self.assertTrue(process.IsValid(), PROCESS_IS_VALID)
35 # Get the thread of the process
36 self.assertTrue(process.GetState() == lldb.eStateStopped, PROCESS_STOPPED)
37 thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
40 # Get frame for current thread
41 frame = thread.GetSelectedFrame()
43 v1 = frame.EvaluateExpression("1")
44 self.assertTrue(v1.IsValid(), "'expr 1' results in a valid SBValue object")
45 self.assertTrue(v1.GetError().Success(), "'expr 1' succeeds without an error.")
47 v2 = frame.EvaluateExpression("this")
48 self.assertTrue(v2.IsValid(), "'expr this' results in a valid SBValue object")
49 self.assertTrue(v2.GetError().Success(), "'expr this' succeeds without an error.")