Skip to content

Instantly share code, notes, and snippets.

@mattcox
Created July 21, 2017 22:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattcox/310d8a1603c7ee63c31959af224eaf7e to your computer and use it in GitHub Desktop.
Save mattcox/310d8a1603c7ee63c31959af224eaf7e to your computer and use it in GitHub Desktop.
This script when attached to a breakpoint will continue lldb if the provided function doesn't appear in the current backtrace.
#!/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