Skip to content

Instantly share code, notes, and snippets.

@aufflick
Created February 12, 2014 00:03
Show Gist options
  • Save aufflick/8947131 to your computer and use it in GitHub Desktop.
Save aufflick/8947131 to your computer and use it in GitHub Desktop.
my Reveal lldb setup, based on @orj and @chrismiles efforts
command script import /opt/lldb-scripts/reveal.py
command alias interface_inspector p (BOOL)[[NSBundle bundleWithPath:@"/Applications/Interface Inspector.app/Contents/Resources/InterfaceInspectorRemote.framework"] load]
command alias reveal_load_sim expr (void*)dlopen("/Applications/Reveal.app/Contents/SharedSupport/iOS-Libraries/libReveal.dylib", 0x2);
command alias reveal_load_dev expr (void*)dlopen([(NSString*)[(NSBundle*)[NSBundle mainBundle] pathForResource:@"libReveal" ofType:@"dylib"] cStringUsingEncoding:0x4], 0x2);
command alias reveal_start expr (void)[(NSNotificationCenter*)[NSNotificationCenter defaultCenter] postNotificationName:@"IBARevealRequestStart" object:nil];
command alias reveal_stop expr (void)[(NSNotificationCenter*)[NSNotificationCenter defaultCenter] postNotificationName:@"IBARevealRequestStop" object:nil];
""" 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'
from subprocess import call
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)')
lldb.debugger.HandleCommand('call (void)[(NSNotificationCenter*)[NSNotificationCenter defaultCenter] postNotificationName:@"IBARevealRequestStart" object:nil]')
# lldb.debugger.HandleCommand('continue')
def __lldb_init_module(debugger, internal_dict):
debugger.HandleCommand('command script add -f reveal.auto_load_reveal reveal')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment