Skip to content

Instantly share code, notes, and snippets.

@robinhp
Created November 5, 2014 03:17
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 robinhp/96f371f1f635f9e3d23f to your computer and use it in GitHub Desktop.
Save robinhp/96f371f1f635f9e3d23f to your computer and use it in GitHub Desktop.
manipulate NSStrings via python and LLDB
import lldb
def rhptest(debugger, command, result, internal_dict):
frame = lldb.debugger.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame()
value = frame.EvaluateExpression(command)
string_value = value.GetObjectDescription()
print >>result, string_value.upper()
def __lldb_init_module(debugger, internal_dict):
debugger.HandleCommand('command script add -f rhptest.rhptest rhptest')
print 'The "rhptest" python command has been installed and is ready for use.'
# Load via: command script import path/to/rhptest.py
# (lldb)rhptest @"hello"
# HELLO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment