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
):
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")
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
)
26 breakpoint
.IsValid() and breakpoint
.GetNumLocations() >= 1, VALID_BREAKPOINT
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
)
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.")