diff options
Diffstat (limited to 'lldb')
3 files changed, 17 insertions, 19 deletions
diff --git a/lldb/test/functionalities/conditional_break/.lldb b/lldb/test/functionalities/conditional_break/.lldb index 6774cfc7e89..52fc2ddd647 100644 --- a/lldb/test/functionalities/conditional_break/.lldb +++ b/lldb/test/functionalities/conditional_break/.lldb @@ -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" diff --git a/lldb/test/functionalities/conditional_break/TestConditionalBreak.py b/lldb/test/functionalities/conditional_break/TestConditionalBreak.py index 6f177a813dc..20a1eaa2ace 100644 --- a/lldb/test/functionalities/conditional_break/TestConditionalBreak.py +++ b/lldb/test/functionalities/conditional_break/TestConditionalBreak.py @@ -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" diff --git a/lldb/test/functionalities/conditional_break/conditional_break.py b/lldb/test/functionalities/conditional_break/conditional_break.py index 840dc452c39..abb337d306a 100644 --- a/lldb/test/functionalities/conditional_break/conditional_break.py +++ b/lldb/test/functionalities/conditional_break/conditional_break.py @@ -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 |

