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.
This commit is contained in:
jimingham authored and GitHub committed 2024-07-03 10:39:34 -07:00
1 parent 94471e6d23
commit 77d131eddb
13 files changed
+202 -13

No files matched your search

@@ -160,13 +160,16 @@ public:
lldb_private::CommandReturnObject &cmd_retobj, Status &error,
const lldb_private::ExecutionContext &exe_ctx) override;
virtual bool RunScriptBasedParsedCommand(
StructuredData::GenericSP impl_obj_sp, Args& args,
bool RunScriptBasedParsedCommand(
StructuredData::GenericSP impl_obj_sp, Args &args,
ScriptedCommandSynchronicity synchronicity,
lldb_private::CommandReturnObject &cmd_retobj, Status &error,
const lldb_private::ExecutionContext &exe_ctx) override;
std::optional<std::string>
GetRepeatCommandForScriptedCommand(StructuredData::GenericSP impl_obj_sp,
Args &args) override;
Status GenerateFunction(const char *signature, const StringList &input,
bool is_callback) override;