Skip to content

Instantly share code, notes, and snippets.

@lanzafame
Forked from zrxq/.lldbinit
Last active August 29, 2015 14:19
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 lanzafame/51d05c37d4bdbc087880 to your computer and use it in GitHub Desktop.
Save lanzafame/51d05c37d4bdbc087880 to your computer and use it in GitHub Desktop.
comma script import ~/lldb/subl.py
comma script add -f subl.subl subl
# 1. Edit your ~/.lldbinit
# 2. Put this file (subl.py) in ~/lldb/
# 3. Restart Xcode
# 4. Test the command:
#
# (lldb) subl <any lldb command>
#
# e.g.
#
# (lldb) subl po myArray
#
# or
#
# (lldb) subl help
#
# 5. If it doesn't work, make sure you have `subl` installed and the path (see below) is correct
#
# See also: http://www.sublimetext.com/docs/3/osx_command_line.html
#
import lldb
import subprocess
def subl(debugger, command, result, dict):
res = lldb.SBCommandReturnObject()
comminter = debugger.GetCommandInterpreter()
comminter.HandleCommand(command, res)
if not res.Succeeded():
return
output = res.GetOutput()
subl = subprocess.Popen(['/usr/local/bin/subl','--stay', '-'], shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
subl.stdin.write(output)
subl.stdin.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment