[Lldb-commits] [lldb] r113598 - in /lldb/trunk/test/conditional_break: .lldb conditional_break.py

Johnny Chen johnny.chen at apple.com
Fri Sep 10 11:28:27 PDT 2010


Author: johnny
Date: Fri Sep 10 13:28:27 2010
New Revision: 113598

URL: http://llvm.org/viewvc/llvm-project?rev=113598&view=rev
Log:
These two files should have been in r113596.  Oops!

Added:
    lldb/trunk/test/conditional_break/.lldb
    lldb/trunk/test/conditional_break/conditional_break.py

Added: lldb/trunk/test/conditional_break/.lldb
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/conditional_break/.lldb?rev=113598&view=auto
==============================================================================
--- lldb/trunk/test/conditional_break/.lldb (added)
+++ lldb/trunk/test/conditional_break/.lldb Fri Sep 10 13:28:27 2010
@@ -0,0 +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 -p 1 "conditional_break.stop_if_called_from_a()"
+

Added: lldb/trunk/test/conditional_break/conditional_break.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/conditional_break/conditional_break.py?rev=113598&view=auto
==============================================================================
--- lldb/trunk/test/conditional_break/conditional_break.py (added)
+++ lldb/trunk/test/conditional_break/conditional_break.py Fri Sep 10 13:28:27 2010
@@ -0,0 +1,27 @@
+import sys
+import lldb
+import lldbutil
+
+def stop_if_called_from_a():
+    dbg = lldb.SBDebugger.FindDebuggerWithID(lldb.debugger_unique_id)
+    dbg.SetAsync(False)
+    ci = dbg.GetCommandInterpreter()
+    res = lldb.SBCommandReturnObject()
+
+    target = dbg.GetSelectedTarget()
+    process = target.GetProcess()
+    thread = process.GetThreadAtIndex(0)
+
+    print >> sys.stderr, "Checking call frames..."
+    lldbutil.PrintStackTrace(thread)
+    if thread.GetNumFrames() >= 2:
+        funcs = lldbutil.GetFunctionNames(thread)
+        print >> sys.stderr, funcs[0], "called from", funcs[1]
+        if (funcs[0] == 'c' and funcs[1] == 'a'):
+            print >> sys.stderr, "Stopped at c() with immediate caller as a()."
+        else:
+            print >> sys.stderr, "Continuing..."
+            ci.HandleCommand("process continue", res)
+
+    return True
+





More information about the lldb-commits mailing list