diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-07-19 07:03:07 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-07-19 07:03:07 +0000 | 
| commit | a884e649599e13d58ce6d2b2a0ce8091ceb48dac (patch) | |
| tree | f527514e113dd4f771eef3d39e5a5d2da36b8552 /packages/Python/lldbsuite | |
| parent | e75e363cb71a7339552b9d943e78ac62b737379b (diff) | |
Notes
Diffstat (limited to 'packages/Python/lldbsuite')
3 files changed, 7 insertions, 84 deletions
| diff --git a/packages/Python/lldbsuite/test/expression_command/unwind_expression/TestUnwindExpression.py b/packages/Python/lldbsuite/test/expression_command/unwind_expression/TestUnwindExpression.py index 9cc585b75aa1a..3b01d4470de65 100644 --- a/packages/Python/lldbsuite/test/expression_command/unwind_expression/TestUnwindExpression.py +++ b/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/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py index ca05356f96964..6f06ca7770c84 100644 --- a/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py +++ b/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/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoints/TestConsecutiveBreakpoints.py b/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoints/TestConsecutiveBreakpoints.py index 312f2944102e4..6afde150d8d71 100644 --- a/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoints/TestConsecutiveBreakpoints.py +++ b/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) | 
