summaryrefslogtreecommitdiff
path: root/lldb/examples/python
diff options
context:
space:
mode:
authorjimingham <jingham@apple.com>2024-07-03 10:39:34 -0700
committerGitHub <noreply@github.com>2024-07-03 10:39:34 -0700
commit77d131eddb6ca9060c844fae9cb78779fa70c8f0 (patch)
treef540d78500a8a832a701db3e25b8a53dc91d0fac /lldb/examples/python
parent94471e6d238acab291b5b652fc18f17c4815cc7d (diff)
Add the ability for Script based commands to specify their "repeat command" (#94823)
Among other things, returning an empty string as the repeat command disables auto-repeat, which can be useful for state-changing commands. There's one remaining refinement to this setup, which is that for parsed script commands, it should be possible to change an option value, or add a new option value that wasn't originally specified, then ask lldb "make this back into a command string". That would make doing fancy things with repeat commands easier. That capability isn't present in the lldb_private side either, however. So that's for a next iteration. I haven't added this to the docs on adding commands yet. I wanted to make sure this was an acceptable approach before I spend the time to do that.
Diffstat (limited to 'lldb/examples/python')
-rw-r--r--lldb/examples/python/cmdtemplate.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/lldb/examples/python/cmdtemplate.py b/lldb/examples/python/cmdtemplate.py
index 49a08365268f..9a96888508b6 100644
--- a/lldb/examples/python/cmdtemplate.py
+++ b/lldb/examples/python/cmdtemplate.py
@@ -19,7 +19,7 @@ class FrameStatCommand(ParsedCommand):
@classmethod
def register_lldb_command(cls, debugger, module_name):
- ParsedCommandBase.do_register_cmd(cls, debugger, module_name)
+ ParsedCommand.do_register_cmd(cls, debugger, module_name)
print(
'The "{0}" command has been installed, type "help {0}" or "{0} '
'--help" for detailed help.'.format(cls.program)
@@ -72,6 +72,10 @@ class FrameStatCommand(ParsedCommand):
default = True,
)
+ def get_repeat_command(self, args):
+ """As an example, make the command not auto-repeat:"""
+ return ""
+
def get_short_help(self):
return "Example command for use in debugging"