forked from OSchip/llvm-project
These two files should have been in r113596. Oops!
llvm-svn: 113598
This commit is contained in:
parent
ed19768cec
commit
bc1857ba36
lldb/test/conditional_break
|
@ -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()"
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue