Last active
October 25, 2021 18:53
-
-
Save Bunn/1f7c04b62851152e2aece93e18c01245 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
import lldb | |
def __lldb_init_module(debugger, internal_dict): | |
debugger.HandleCommand('command script add -f SwiftPrinter.printer pjson') | |
def printer(debugger, command, result, internal_dict): | |
debugger.HandleCommand('p print(String(data: try! JSONSerialization.data(withJSONObject:' + command + ', options: .prettyPrinted), encoding: .utf8 )!)') |
Nice! Never done this before, where is/should be .lldbinit
located? In the home directory?
Nice! Never done this before, where is/should be
.lldbinit
located? In the home directory?
Yes, @eneko home directory, for example:
cat ~/.lldbinit
command script import ~/lldb/SwiftPrinter.py
Great, thanks 👍
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To use the script you'll need to import it first:
command script import $PATH_TO_YOUR_PYTHON_FILE
For example:
Or set it up in your
.lldbinit
file