[Lldb-commits] [lldb] r177196 - Make the conditional break test case a little more robust.
Jim Ingham
jingham at apple.com
Fri Mar 15 15:19:28 PDT 2013
Author: jingham
Date: Fri Mar 15 17:19:27 2013
New Revision: 177196
URL: http://llvm.org/viewvc/llvm-project?rev=177196&view=rev
Log:
Make the conditional break test case a little more robust.
Modified:
lldb/trunk/test/functionalities/conditional_break/.lldb
lldb/trunk/test/functionalities/conditional_break/TestConditionalBreak.py
lldb/trunk/test/functionalities/conditional_break/conditional_break.py
Modified: lldb/trunk/test/functionalities/conditional_break/.lldb
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/conditional_break/.lldb?rev=177196&r1=177195&r2=177196&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/conditional_break/.lldb (original)
+++ lldb/trunk/test/functionalities/conditional_break/.lldb Fri Mar 15 17:19:27 2013
@@ -1,7 +1,7 @@
file a.out
breakpoint set -n c
-script import sys, os
-script sys.path.append(os.path.join(os.getcwd(), os.pardir))
-script import conditional_break
-breakpoint command add -s python 1 -o "conditional_break.stop_if_called_from_a()"
+#script import sys, os
+#script sys.path.append(os.path.join(os.getcwd(), os.pardir))
+command script import -r conditional_break.py
+breakpoint command add 1 -F "conditional_break.stop_if_called_from_a"
Modified: lldb/trunk/test/functionalities/conditional_break/TestConditionalBreak.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/conditional_break/TestConditionalBreak.py?rev=177196&r1=177195&r2=177196&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/conditional_break/TestConditionalBreak.py (original)
+++ lldb/trunk/test/functionalities/conditional_break/TestConditionalBreak.py Fri Mar 15 17:19:27 2013
@@ -116,9 +116,14 @@ class ConditionalBreakTestCase(TestBase)
self.HideStdout()
self.runCmd("command source .lldb")
+ self.runCmd ("break list")
+
if self.TraceOn():
print "About to run."
self.runCmd("run", RUN_SUCCEEDED)
+
+ self.runCmd ("break list")
+
if self.TraceOn():
print "Done running"
Modified: lldb/trunk/test/functionalities/conditional_break/conditional_break.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/conditional_break/conditional_break.py?rev=177196&r1=177195&r2=177196&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/conditional_break/conditional_break.py (original)
+++ lldb/trunk/test/functionalities/conditional_break/conditional_break.py Fri Mar 15 17:19:27 2013
@@ -1,38 +1,31 @@
import sys
import lldb
-import lldbutil
-def stop_if_called_from_a():
- # lldb.debugger_unique_id stores the id of the debugger associated with us.
- dbg = lldb.SBDebugger.FindDebuggerWithID(lldb.debugger_unique_id)
+def stop_if_called_from_a(frame, bp_loc, dict):
+
+ thread = frame.GetThread()
+ process = thread.GetProcess()
+ target = process.GetTarget()
+ dbg = target.GetDebugger()
# Perform synchronous interaction with the debugger.
old_async = dbg.GetAsync()
dbg.SetAsync(True)
- # Retrieve the target, process, and the only thread.
- target = dbg.GetSelectedTarget()
- process = target.GetProcess()
- thread = process.GetThreadAtIndex(0)
-
# We check the call frames in order to stop only when the immediate caller
# of the leaf function c() is a(). If it's not the right caller, we ask the
# command interpreter to continue execution.
- print >> sys.stdout, "Checking call frames..."
- lldbutil.print_stacktrace(thread)
should_stop = True
if thread.GetNumFrames() >= 2:
- funcs = lldbutil.get_function_names(thread)
- print >> sys.stdout, funcs[0], "called from", funcs[1]
- if (funcs[0] == 'c' and funcs[1] == 'a'):
+
+ if (thread.frames[0].function.name == 'c' and thread.frames[1].function.name == 'a'):
should_stop = True
else:
process.Continue()
should_stop = False
dbg.SetAsync(old_async)
- print >> sys.stdout, "stop_if_called_from_a returning: ", should_stop
return should_stop
More information about the lldb-commits
mailing list