This script when attached to a breakpoint will continue lldb if the provided function doesn't appear in the current backtrace.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
''' | |
This script when attached to a breakpoint will continue lldb if the provided | |
function doesn't appear in the current backtrace. | |
To use this script, add a file called .lldbinit to your home directory, | |
with the following line: | |
command script import <PATH TO THIS SCRIPT> | |
Then add the command "continueOnFunctionMiss functionName" to an XCode breakpoint. | |
''' | |
import lldb | |
def continueOnFunctionMiss (debugger, command, result, internal_dict): | |
if len (command) > 0: | |
process = debugger.GetSelectedTarget ().GetProcess () | |
thread = process.GetSelectedThread () | |
for frame in thread: | |
function = frame.GetFunction () | |
if function.IsValid (): | |
if function.GetDisplayName () == command: | |
return | |
if process.IsValid (): | |
lldb.debugger.SetAsync (True) | |
process.Continue () | |
def __lldb_init_module (debugger, internal_dict): | |
debugger.HandleCommand ('command script add -f continueOnFunctionMiss.continueOnFunctionMiss continueOnFunctionMiss') | |
print 'The "continueOnFunctionMiss" python command has been installed and is ready for use.' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment