From 635f03fe976e250cc64999663f47716412dfa029 Mon Sep 17 00:00:00 2001 From: Jim Ingham Date: Fri, 4 Feb 2022 15:16:31 -0800 Subject: Add a repeat command option for "thread backtrace --count N". This way if you have a long stack, you can issue "thread backtrace --count 10" and then subsequent -s will page you through the stack. This took a little more effort than just adding the repeat command, since the GetRepeatCommand API was returning a "const char *". That meant the command had to keep the repeat string alive, which is inconvenient. The original API returned either a nullptr, or a const char *, so I changed the private API to return an llvm::Optional. Most of the patch is propagating that change. Also, there was a little thinko in fetching the repeat command. We don't fetch repeat commands for commands that aren't being added to history, which is in general reasonable. And we don't add repeat commands to the history - also reasonable. But we do want the repeat command to be able to generate the NEXT repeat command. So I adjusted the logic in HandleCommand to work that way. Differential Revision: https://reviews.llvm.org/D119046 --- lldb/source/Commands/CommandObjectCommands.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lldb/source/Commands/CommandObjectCommands.cpp') diff --git a/lldb/source/Commands/CommandObjectCommands.cpp b/lldb/source/Commands/CommandObjectCommands.cpp index 4b4932d..ebb84bc 100644 --- a/lldb/source/Commands/CommandObjectCommands.cpp +++ b/lldb/source/Commands/CommandObjectCommands.cpp @@ -56,9 +56,9 @@ public: ~CommandObjectCommandsSource() override = default; - const char *GetRepeatCommand(Args ¤t_command_args, - uint32_t index) override { - return ""; + llvm::Optional GetRepeatCommand(Args ¤t_command_args, + uint32_t index) override { + return std::string(""); } void -- cgit v1.1