2 from lldbsuite.test.decorators import *
3 from lldbsuite.test.lldbtest import *
4 from lldbsuite.test import lldbutil
7 class TestCppChainedCalls(TestBase):
9 mydir = TestBase.compute_mydir(__file__)
11 @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21765")
12 def test_with_run_command(self):
15 # Get main source file
17 src_file_spec = lldb.SBFileSpec(src_file)
18 self.assertTrue(src_file_spec.IsValid(), "Main source file")
20 # Get the path of the executable
23 exe_path = os.path.join(cwd, exe_file)
26 target = self.dbg.CreateTarget(exe_path)
27 self.assertTrue(target.IsValid(), VALID_TARGET)
29 # Break on main function
30 main_breakpoint = target.BreakpointCreateBySourceRegex(
31 "break here", src_file_spec)
33 main_breakpoint.IsValid() and main_breakpoint.GetNumLocations() >= 1,
39 process = target.LaunchSimple(
40 args, env, self.get_process_working_directory())
41 self.assertTrue(process.IsValid(), PROCESS_IS_VALID)
43 # Get the thread of the process
45 process.GetState() == lldb.eStateStopped,
47 thread = lldbutil.get_stopped_thread(
48 process, lldb.eStopReasonBreakpoint)
50 # Get frame for current thread
51 frame = thread.GetSelectedFrame()
54 test_result = frame.EvaluateExpression("get(set(true))")
56 test_result.IsValid() and test_result.GetValue() == "true",
57 "get(set(true)) = true")
59 test_result = frame.EvaluateExpression("get(set(false))")
61 test_result.IsValid() and test_result.GetValue() == "false",
62 "get(set(false)) = false")
64 test_result = frame.EvaluateExpression("get(t & f)")
66 test_result.IsValid() and test_result.GetValue() == "false",
69 test_result = frame.EvaluateExpression("get(f & t)")
71 test_result.IsValid() and test_result.GetValue() == "false",
74 test_result = frame.EvaluateExpression("get(t & t)")
76 test_result.IsValid() and test_result.GetValue() == "true",
79 test_result = frame.EvaluateExpression("get(f & f)")
81 test_result.IsValid() and test_result.GetValue() == "false",
84 test_result = frame.EvaluateExpression("get(t & f)")
86 test_result.IsValid() and test_result.GetValue() == "false",
89 test_result = frame.EvaluateExpression("get(f) && get(t)")
91 test_result.IsValid() and test_result.GetValue() == "false",
92 "get(f) && get(t) = false")
94 test_result = frame.EvaluateExpression("get(f) && get(f)")
96 test_result.IsValid() and test_result.GetValue() == "false",
97 "get(f) && get(t) = false")
99 test_result = frame.EvaluateExpression("get(t) && get(t)")
101 test_result.IsValid() and test_result.GetValue() == "true",
102 "get(t) && get(t) = true")