Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / test / API / lang / cpp / limit-debug-info / TestWithLimitDebugInfo.py
bloba4422cee91f0326a01ea8a375c7b6ab152ae2a1f
1 import lldb
2 from lldbsuite.test.decorators import *
3 from lldbsuite.test.lldbtest import *
4 from lldbsuite.test import lldbutil
7 class TestWithLimitDebugInfo(TestBase):
8 @add_test_categories(["dwarf", "dwo"])
9 def test_limit_debug_info(self):
10 self.build()
12 src_file = os.path.join(self.getSourceDir(), "main.cpp")
13 src_file_spec = lldb.SBFileSpec(src_file)
14 self.assertTrue(src_file_spec.IsValid(), "breakpoint file")
16 # Get the path of the executable
17 exe_path = self.getBuildArtifact("a.out")
19 # Load the executable
20 target = self.dbg.CreateTarget(exe_path)
21 self.assertTrue(target.IsValid(), VALID_TARGET)
23 # Break on main function
24 breakpoint = target.BreakpointCreateBySourceRegex("break here", src_file_spec)
25 self.assertTrue(
26 breakpoint.IsValid() and breakpoint.GetNumLocations() >= 1, VALID_BREAKPOINT
29 # Launch the process
30 process = target.LaunchSimple(None, None, self.get_process_working_directory())
31 self.assertTrue(process.IsValid(), PROCESS_IS_VALID)
33 # Get the thread of the process
34 self.assertEqual(process.GetState(), lldb.eStateStopped, PROCESS_STOPPED)
35 thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
36 thread.StepInto()
38 # Get frame for current thread
39 frame = thread.GetSelectedFrame()
41 self.expect_expr("1", result_type="int", result_value="1")
43 v2 = frame.EvaluateExpression("this")
44 self.assertTrue(v2.IsValid(), "'expr this' results in a valid SBValue object")
45 self.assertSuccess(v2.GetError(), "'expr this' succeeds without an error.")