-
-
Save lanzafame/51d05c37d4bdbc087880 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
comma script import ~/lldb/subl.py | |
comma script add -f subl.subl subl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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