diff options
author | Jim Ingham <jingham@apple.com> | 2017-07-13 19:46:21 +0000 |
---|---|---|
committer | Jim Ingham <jingham@apple.com> | 2017-07-13 19:46:21 +0000 |
commit | 61949c9f6f82416f5d6599d02a834a944eb3168b (patch) | |
tree | 1059189fae4fc3624defd000939eb1f0f9cdb7b6 /lldb/packages/Python/lldbsuite/test | |
parent | 30bac791621d1f429fa9d6f4d212423f607378b8 (diff) | |
download | bcm5719-llvm-61949c9f6f82416f5d6599d02a834a944eb3168b.tar.gz bcm5719-llvm-61949c9f6f82416f5d6599d02a834a944eb3168b.zip |
Convert a few more tests to use run_to_source_breakpoint.
llvm-svn: 307943
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test')
3 files changed, 7 insertions, 84 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/expression_command/unwind_expression/TestUnwindExpression.py b/lldb/packages/Python/lldbsuite/test/expression_command/unwind_expression/TestUnwindExpression.py index 9cc585b75aa..3b01d4470de 100644 --- a/lldb/packages/Python/lldbsuite/test/expression_command/unwind_expression/TestUnwindExpression.py +++ b/lldb/packages/Python/lldbsuite/test/expression_command/unwind_expression/TestUnwindExpression.py @@ -23,32 +23,8 @@ class UnwindFromExpressionTest(TestBase): def build_and_run_to_bkpt(self): self.build() - exe = os.path.join(os.getcwd(), "a.out") - - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) - - # Create the breakpoint. - breakpoint = target.BreakpointCreateBySourceRegex( - "// Set a breakpoint here to get started", self.main_spec) - self.assertTrue(breakpoint, VALID_BREAKPOINT) - - # Launch the process, and do not stop at the entry point. - process = target.LaunchSimple( - None, None, self.get_process_working_directory()) - - if not process: - self.fail("SBTarget.LaunchProcess() failed") - - if process.GetState() != lldb.eStateStopped: - self.fail("Process should be in the 'stopped' state, " - "instead the actual state is: '%s'" % - lldbutil.state_type_to_str(process.GetState())) - - self.thread = lldbutil.get_one_thread_stopped_at_breakpoint( - process, breakpoint) - self.assertIsNotNone( - self.thread, "Expected one thread to be stopped at the breakpoint") + (target, process, self.thread, bkpt) = lldbutil.run_to_source_breakpoint(self, + "// Set a breakpoint here to get started", self.main_spec) # Next set a breakpoint in this function, set up Expression options to stop on # breakpoint hits, and call the function. diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py index ca05356f969..6f06ca7770c 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py @@ -30,46 +30,13 @@ class BadAddressBreakpointTestCase(TestBase): def address_breakpoints(self): """Test that breakpoints set on a bad address say they are bad.""" - exe = os.path.join(os.getcwd(), "a.out") - # Create a target by the debugger. - target = self.dbg.CreateTarget(exe) - self.assertTrue(target, VALID_TARGET) - - # Now create a breakpoint on main.c by name 'c'. - breakpoint = target.BreakpointCreateBySourceRegex( - "Set a breakpoint here", lldb.SBFileSpec("main.c")) - self.assertTrue(breakpoint and - breakpoint.GetNumLocations() == 1, - VALID_BREAKPOINT) - - # Get the breakpoint location from breakpoint after we verified that, - # indeed, it has one location. - location = breakpoint.GetLocationAtIndex(0) - self.assertTrue(location and - location.IsEnabled(), - VALID_BREAKPOINT_LOCATION) - - launch_info = lldb.SBLaunchInfo(None) - - error = lldb.SBError() - - process = target.Launch(launch_info, error) - self.assertTrue(process, PROCESS_IS_VALID) - - # Did we hit our breakpoint? - from lldbsuite.test.lldbutil import get_threads_stopped_at_breakpoint - threads = get_threads_stopped_at_breakpoint(process, breakpoint) - self.assertTrue( - len(threads) == 1, - "There should be a thread stopped at our breakpoint") - - # The hit count for the breakpoint should be 1. - self.assertTrue(breakpoint.GetHitCount() == 1) + (target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(self, + "Set a breakpoint here", lldb.SBFileSpec("main.c")) # Now see if we can read from 0. If I can't do that, I don't have a good way to know # what an illegal address is... - error.Clear() + error = lldb.SBError() ptr = process.ReadPointerFromMemory(0x0, error) diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoints/TestConsecutiveBreakpoints.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoints/TestConsecutiveBreakpoints.py index 312f2944102..6afde150d8d 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoints/TestConsecutiveBreakpoints.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoints/TestConsecutiveBreakpoints.py @@ -18,29 +18,9 @@ class ConsecutiveBreakpointsTestCase(TestBase): def prepare_test(self): self.build() - exe = os.path.join(os.getcwd(), "a.out") - # Create a target by the debugger. - self.target = self.dbg.CreateTarget(exe) - self.assertTrue(self.target, VALID_TARGET) - - breakpoint1 = self.target.BreakpointCreateBySourceRegex( - "Set breakpoint here", lldb.SBFileSpec("main.cpp")) - self.assertTrue( - breakpoint1 and breakpoint1.GetNumLocations() == 1, - VALID_BREAKPOINT) - - # Now launch the process, and do not stop at entry point. - self.process = self.target.LaunchSimple( - None, None, self.get_process_working_directory()) - self.assertIsNotNone(self.process, PROCESS_IS_VALID) - - # We should be stopped at the first breakpoint - self.thread = lldbutil.get_one_thread_stopped_at_breakpoint( - self.process, breakpoint1) - self.assertIsNotNone( - self.thread, - "Expected one thread to be stopped at breakpoint 1") + (self.target, self.process, self.thread, bkpt) = lldbutil.run_to_source_breakpoint( + self, "Set breakpoint here", lldb.SBFileSpec("main.cpp")) # Set breakpoint to the next instruction frame = self.thread.GetFrameAtIndex(0) |