Last active
May 17, 2019 13:49
-
-
Save kastiglione/1d44283f6a730106764685da01694966 to your computer and use it in GitHub Desktop.
Simplifications to writing Python lldb commands as of Xcode 10.2
This file contains hidden or 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
## | |
## Python commands before | |
## | |
def my_command(debugger, input, ctx, result, _): | |
# do stuff | |
pass | |
def __lldb_init_module(debugger, _): | |
debugger.HandleCommand( | |
"command script add --help 'Help text here' --function my_command.my_command my_command" | |
) | |
## | |
## Now with Xcode 10.2 | |
## | |
import lldb | |
# The lldb.command() decorator creates a `my_command` command. | |
@lldb.command() | |
def my_command(debugger, input, ctx, result, _): | |
"Help text is the function docstring" | |
# do stuff | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment