Skip to content

Instantly share code, notes, and snippets.

@kastiglione
Last active May 17, 2019 13:49
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kastiglione/1d44283f6a730106764685da01694966 to your computer and use it in GitHub Desktop.
Save kastiglione/1d44283f6a730106764685da01694966 to your computer and use it in GitHub Desktop.
Simplifications to writing Python lldb commands as of Xcode 10.2
##
## 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