diff options
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/expression_command')
5 files changed, 14 insertions, 99 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/expression_command/issue_11588/Test11588.py b/lldb/packages/Python/lldbsuite/test/expression_command/issue_11588/Test11588.py index afb497e04b5..a2d68cffe54 100644 --- a/lldb/packages/Python/lldbsuite/test/expression_command/issue_11588/Test11588.py +++ b/lldb/packages/Python/lldbsuite/test/expression_command/issue_11588/Test11588.py @@ -32,26 +32,9 @@ class Issue11581TestCase(TestBase): """valobj.AddressOf() should return correct values.""" self.build() - exe = os.path.join(os.getcwd(), "a.out") - - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) - - breakpoint = target.BreakpointCreateBySourceRegex( - 'Set breakpoint here.', lldb.SBFileSpec("main.cpp", False)) - - process = target.LaunchSimple( - None, None, self.get_process_working_directory()) - self.assertTrue(process, "Created a process.") - self.assertTrue( - process.GetState() == lldb.eStateStopped, - "Stopped it too.") - - thread_list = lldbutil.get_threads_stopped_at_breakpoint( - process, breakpoint) - self.assertTrue(len(thread_list) == 1) - thread = thread_list[0] - + (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(self, + 'Set breakpoint here.', + lldb.SBFileSpec("main.cpp", False)) self.runCmd("command script import --allow-reload s11588.py") self.runCmd( "type synthetic add --python-class s11588.Issue11581SyntheticProvider StgClosure") diff --git a/lldb/packages/Python/lldbsuite/test/expression_command/macros/TestMacros.py b/lldb/packages/Python/lldbsuite/test/expression_command/macros/TestMacros.py index 70b862bf486..817f6cb3944 100644 --- a/lldb/packages/Python/lldbsuite/test/expression_command/macros/TestMacros.py +++ b/lldb/packages/Python/lldbsuite/test/expression_command/macros/TestMacros.py @@ -30,32 +30,8 @@ class TestMacros(TestBase): src_file_spec = lldb.SBFileSpec(src_file) self.assertTrue(src_file_spec.IsValid(), "Main source file") - # Get the path of the executable - cwd = os.getcwd() - exe_file = "a.out" - exe_path = os.path.join(cwd, exe_file) - - # Load the executable - target = self.dbg.CreateTarget(exe_path) - self.assertTrue(target.IsValid(), VALID_TARGET) - - # Set breakpoints - bp1 = target.BreakpointCreateBySourceRegex("Break here", src_file_spec) - self.assertTrue( - bp1.IsValid() and bp1.GetNumLocations() >= 1, - VALID_BREAKPOINT) - - # Launch the process - process = target.LaunchSimple( - None, None, self.get_process_working_directory()) - self.assertTrue(process.IsValid(), PROCESS_IS_VALID) - - # Get the thread of the process - self.assertTrue( - process.GetState() == lldb.eStateStopped, - PROCESS_STOPPED) - thread = lldbutil.get_stopped_thread( - process, lldb.eStopReasonBreakpoint) + (target, process, thread, bp1) = lldbutil.run_to_source_breakpoint( + self, "Break here", src_file_spec) # Get frame for current thread frame = thread.GetSelectedFrame() diff --git a/lldb/packages/Python/lldbsuite/test/expression_command/options/TestExprOptions.py b/lldb/packages/Python/lldbsuite/test/expression_command/options/TestExprOptions.py index 0d1a17352a3..b4e9a8bfeab 100644 --- a/lldb/packages/Python/lldbsuite/test/expression_command/options/TestExprOptions.py +++ b/lldb/packages/Python/lldbsuite/test/expression_command/options/TestExprOptions.py @@ -37,25 +37,10 @@ class ExprOptionsTestCase(TestBase): # Set debugger into synchronous mode self.dbg.SetAsync(False) - # Create a target by the debugger. - target = self.dbg.CreateTarget(self.exe) - self.assertTrue(target, VALID_TARGET) + (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint( + self, '// breakpoint_in_main', self.main_source_spec) - # Set breakpoints inside main. - breakpoint = target.BreakpointCreateBySourceRegex( - '// breakpoint_in_main', self.main_source_spec) - self.assertTrue(breakpoint) - - # Now launch the process, and do not stop at entry point. - process = target.LaunchSimple( - None, None, self.get_process_working_directory()) - self.assertTrue(process, PROCESS_IS_VALID) - - threads = lldbutil.get_threads_stopped_at_breakpoint( - process, breakpoint) - self.assertEqual(len(threads), 1) - - frame = threads[0].GetFrameAtIndex(0) + frame = thread.GetFrameAtIndex(0) options = lldb.SBExpressionOptions() # test --language on C++ expression using the SB API's diff --git a/lldb/packages/Python/lldbsuite/test/expression_command/save_jit_objects/TestSaveJITObjects.py b/lldb/packages/Python/lldbsuite/test/expression_command/save_jit_objects/TestSaveJITObjects.py index 7f796971d0e..f6938b1ea98 100644 --- a/lldb/packages/Python/lldbsuite/test/expression_command/save_jit_objects/TestSaveJITObjects.py +++ b/lldb/packages/Python/lldbsuite/test/expression_command/save_jit_objects/TestSaveJITObjects.py @@ -31,17 +31,10 @@ class SaveJITObjectsTestCase(TestBase): src_file = "main.c" src_file_spec = lldb.SBFileSpec(src_file) - exe_path = os.path.join(os.getcwd(), "a.out") - target = self.dbg.CreateTarget(exe_path) + (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint( + self, "break", src_file_spec) - breakpoint = target.BreakpointCreateBySourceRegex( - "break", src_file_spec) - - process = target.LaunchSimple(None, None, - self.get_process_working_directory()) - - thread = process.GetSelectedThread() - frame = thread.GetSelectedFrame() + frame = thread.frames[0] cleanJITFiles() frame.EvaluateExpression("(void*)malloc(0x1)") diff --git a/lldb/packages/Python/lldbsuite/test/expression_command/timeout/TestCallWithTimeout.py b/lldb/packages/Python/lldbsuite/test/expression_command/timeout/TestCallWithTimeout.py index 29c03b1d7ef..7862477001e 100644 --- a/lldb/packages/Python/lldbsuite/test/expression_command/timeout/TestCallWithTimeout.py +++ b/lldb/packages/Python/lldbsuite/test/expression_command/timeout/TestCallWithTimeout.py @@ -25,36 +25,14 @@ class ExprCommandWithTimeoutsTestCase(TestBase): @expectedFlakeyFreeBSD("llvm.org/pr19605") @expectedFailureAll( oslist=[ - "windows", - "macosx"], + "windows"], bugnumber="llvm.org/pr21765") def test(self): """Test calling std::String member function.""" self.build() - exe_name = "a.out" - exe = os.path.join(os.getcwd(), exe_name) - - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) - - breakpoint = target.BreakpointCreateBySourceRegex( - 'stop here in main.', self.main_source_spec) - self.assertTrue(breakpoint, VALID_BREAKPOINT) - self.runCmd("breakpoint list") - - # Launch the process, and do not stop at the entry point. - process = target.LaunchSimple( - None, None, self.get_process_working_directory()) - - self.assertTrue(process, PROCESS_IS_VALID) - - # Frame #0 should be on self.step_out_of_malloc. - threads = lldbutil.get_threads_stopped_at_breakpoint( - process, breakpoint) - - self.assertTrue(len(threads) == 1) - thread = threads[0] + (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint( + self, 'stop here in main.', self.main_source_spec) # First set the timeout too short, and make sure we fail. options = lldb.SBExpressionOptions() |