2 from lldbsuite.test.lldbtest import *
3 import lldbsuite.test.lldbutil as lldbutil
5 class TestCppChainedCalls(TestBase):
7 mydir = TestBase.compute_mydir(__file__)
9 @expectedFailureWindows("llvm.org/pr21765")
10 def test_with_run_command(self):
13 # Get main source file
15 src_file_spec = lldb.SBFileSpec(src_file)
16 self.assertTrue(src_file_spec.IsValid(), "Main source file")
18 # Get the path of the executable
21 exe_path = os.path.join(cwd, exe_file)
24 target = self.dbg.CreateTarget(exe_path)
25 self.assertTrue(target.IsValid(), VALID_TARGET)
27 # Break on main function
28 main_breakpoint = target.BreakpointCreateBySourceRegex("break here", src_file_spec)
29 self.assertTrue(main_breakpoint.IsValid() and main_breakpoint.GetNumLocations() >= 1, VALID_BREAKPOINT)
34 process = target.LaunchSimple(args, env, self.get_process_working_directory())
35 self.assertTrue(process.IsValid(), PROCESS_IS_VALID)
37 # Get the thread of the process
38 self.assertTrue(process.GetState() == lldb.eStateStopped, PROCESS_STOPPED)
39 thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
41 # Get frame for current thread
42 frame = thread.GetSelectedFrame()
45 test_result = frame.EvaluateExpression("get(set(true))")
46 self.assertTrue(test_result.IsValid() and test_result.GetValue() == "true", "get(set(true)) = true")
48 test_result = frame.EvaluateExpression("get(set(false))")
49 self.assertTrue(test_result.IsValid() and test_result.GetValue() == "false", "get(set(false)) = false")
51 test_result = frame.EvaluateExpression("get(t & f)")
52 self.assertTrue(test_result.IsValid() and test_result.GetValue() == "false", "get(t & f) = false")
54 test_result = frame.EvaluateExpression("get(f & t)")
55 self.assertTrue(test_result.IsValid() and test_result.GetValue() == "false", "get(f & t) = false")
57 test_result = frame.EvaluateExpression("get(t & t)")
58 self.assertTrue(test_result.IsValid() and test_result.GetValue() == "true", "get(t & t) = true")
60 test_result = frame.EvaluateExpression("get(f & f)")
61 self.assertTrue(test_result.IsValid() and test_result.GetValue() == "false", "get(f & f) = false")
63 test_result = frame.EvaluateExpression("get(t & f)")
64 self.assertTrue(test_result.IsValid() and test_result.GetValue() == "false", "get(t & f) = false")
66 test_result = frame.EvaluateExpression("get(f) && get(t)")
67 self.assertTrue(test_result.IsValid() and test_result.GetValue() == "false", "get(f) && get(t) = false")
69 test_result = frame.EvaluateExpression("get(f) && get(f)")
70 self.assertTrue(test_result.IsValid() and test_result.GetValue() == "false", "get(f) && get(t) = false")
72 test_result = frame.EvaluateExpression("get(t) && get(t)")
73 self.assertTrue(test_result.IsValid() and test_result.GetValue() == "true", "get(t) && get(t) = true")