[Lldb-commits] [lldb] [lldb] Add repeat command for `frame variable` (PR #194195)
via lldb-commits
lldb-commits at lists.llvm.org
Tue Apr 28 10:49:08 PDT 2026
================
@@ -435,6 +437,70 @@ may even involve JITing and running code in the target program.)");
Options *GetOptions() override { return &m_option_group; }
+ // `frame variable` repeats by incrementing the printing depth. When the depth
+ // is too shallow, hitting enter a few times will quickly expand the data.
+ std::optional<std::string> GetRepeatCommand(Args ¤t_command_args,
+ uint32_t index) override {
+ Args repeat_args;
+ auto increment_option =
+ [&](llvm::StringRef option) -> std::optional<std::string> {
+ uint32_t num;
+ bool failed = option.getAsInteger(10, num);
+ if (failed)
+ return std::nullopt;
+ return llvm::utostr(num + 1);
+ };
+
+ bool has_depth_option = false;
+ bool increment_next_arg = false;
+ for (const auto &entry : current_command_args) {
+ llvm::StringRef arg = entry.ref();
+
+ if (increment_next_arg) {
+ increment_next_arg = false;
+ if (auto maybe_opt = increment_option(arg)) {
+ repeat_args.AppendArgument(*maybe_opt);
+ continue;
+ }
+ }
+
+ if (arg == "--depth" || arg == "-D") {
----------------
jimingham wrote:
Does this work if I say `frame var --de 10`? I am pretty sure what comes in before ParseOptions is just whatever the user typed. If so you might have to do the long option name completion, by hand here.
I don't know it there's a clean way to ask the OptionGroup for the command to resolve `--de` to `--depth` however, so you may have to hard code this for now.
https://github.com/llvm/llvm-project/pull/194195
More information about the lldb-commits
mailing list