Skip to content

Instantly share code, notes, and snippets.

@chrismiles
Last active September 2, 2021 00:26
Show Gist options
  • Save chrismiles/7923781 to your computer and use it in GitHub Desktop.
Save chrismiles/7923781 to your computer and use it in GitHub Desktop.
Lazy script to wrap Reveal lib load/start commands in one LLDB command.
""" File: reveal.py
Add to ~/.lldbinit:
command script import ~/.lldb-scripts/reveal.py
Q: Want to automatically load the Reveal lib on launch while debugging from Xcode?
A: In Xcode:
Add a Symbolic Breakpoint
Symbol: "UIApplicationMain"
Action: Debugger Command with value "reveal"
Tick "Automatically continue after evaluating"
"""
__author__ = 'Chris Miles'
__copyright__ = 'Copyright (c) Chris Miles 2013'
__license__ = 'MIT'
import lldb
def auto_load_reveal(debugger, command, result, dict):
lldb.debugger.HandleCommand('call (void*)dlopen("/Applications/Reveal.app/Contents/SharedSupport/iOS-Libraries/libReveal.dylib", 0x2)')
def __lldb_init_module(debugger, internal_dict):
debugger.HandleCommand('command script add -f reveal.auto_load_reveal reveal')
@chrismiles
Copy link
Author

Turns out that "UIApplicationMain" is a better symbol to breakpoint on than "main".

I didn't have any problems with "main", but I noticed that it matched a lot of symbols other than the application main(), so better to be more specific.

@chrismiles
Copy link
Author

Also turns out that the Reveal lib will auto start on load. So I removed the redundant line to signal the Reveal server to start up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment