diff options
| author | Johnny Chen <johnny.chen@apple.com> | 2012-03-05 19:53:24 +0000 |
|---|---|---|
| committer | Johnny Chen <johnny.chen@apple.com> | 2012-03-05 19:53:24 +0000 |
| commit | 35e2ab60397ec15d9a2ce31ad71614ecc62f34b6 (patch) | |
| tree | 5a6f7b4db6e31ed1dd9e97a198faf9e59b01b67c /lldb/test/python_api | |
| parent | d1adb7901091c8ee320b2052df55f86a09225f0a (diff) | |
| download | bcm5719-llvm-35e2ab60397ec15d9a2ce31ad71614ecc62f34b6.tar.gz bcm5719-llvm-35e2ab60397ec15d9a2ce31ad71614ecc62f34b6.zip | |
rdar://problem/10976649
Add SBFrame::IsEqual(const SBFrame &that) method and export it to the Python binding.
Alos add a test case test_frame_api_IsEqual() to TestFrames.py file.
llvm-svn: 152050
Diffstat (limited to 'lldb/test/python_api')
| -rw-r--r-- | lldb/test/python_api/frame/TestFrames.py | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/lldb/test/python_api/frame/TestFrames.py b/lldb/test/python_api/frame/TestFrames.py index dbb3119802c..554755ff18e 100644 --- a/lldb/test/python_api/frame/TestFrames.py +++ b/lldb/test/python_api/frame/TestFrames.py @@ -1,5 +1,6 @@ """ Use lldb Python SBFrame API to get the argument values of the call stacks. +And other SBFrame API tests. """ import os, time @@ -31,6 +32,12 @@ class FrameAPITestCase(TestBase): self.buildDefault() self.frame_api_boundary_condition() + @python_api_test + def test_frame_api_IsEqual(self): + """Exercise SBFrame API IsEqual.""" + self.buildDefault() + self.frame_api_IsEqual() + def do_get_arg_vals(self): """Get argument vals for the call stack when stopped on a breakpoint.""" exe = os.path.join(os.getcwd(), "a.out") @@ -152,6 +159,61 @@ class FrameAPITestCase(TestBase): frame.EvaluateExpression(None) + def frame_api_IsEqual(self): + """Exercise SBFrame API IsEqual.""" + 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.BreakpointCreateByName('c', 'a.out') + #print "breakpoint:", breakpoint + self.assertTrue(breakpoint and + breakpoint.GetNumLocations() == 1, + VALID_BREAKPOINT) + + # Now launch the process, and do not stop at the entry point. + process = target.LaunchSimple(None, None, os.getcwd()) + + process = target.GetProcess() + self.assertTrue(process.GetState() == lldb.eStateStopped, + PROCESS_STOPPED) + + thread = process.GetThreadAtIndex(0) + self.assertTrue(thread) + + frameEntered = thread.GetFrameAtIndex(0) + if self.TraceOn(): + print frameEntered + lldbutil.print_stacktrace(thread) + self.assertTrue(frameEntered) + + # Doing two step overs while still inside c(). + thread.StepOver() + thread.StepOver() + self.assertTrue(thread) + frameNow = thread.GetFrameAtIndex(0) + if self.TraceOn(): + print frameNow + lldbutil.print_stacktrace(thread) + self.assertTrue(frameNow) + + # The latest two frames are considered equal. + self.assertTrue(frameEntered.IsEqual(frameNow)) + + # Now let's step out of frame c(). + thread.StepOutOfFrame(frameNow) + frameOutOfC = thread.GetFrameAtIndex(0) + if self.TraceOn(): + print frameOutOfC + lldbutil.print_stacktrace(thread) + self.assertTrue(frameOutOfC) + + # The latest two frames should not be equal. + self.assertFalse(frameEntered.IsEqual(frameNow)) + if __name__ == '__main__': import atexit |

