[all-commits] [llvm/llvm-project] 635f03: Add a repeat command option for "thread backtrace ...

jimingham via All-commits all-commits at lists.llvm.org
Mon Feb 14 15:48:35 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 635f03fe976e250cc64999663f47716412dfa029
      https://github.com/llvm/llvm-project/commit/635f03fe976e250cc64999663f47716412dfa029
  Author: Jim Ingham <jingham at apple.com>
  Date:   2022-02-14 (Mon, 14 Feb 2022)

  Changed paths:
    M lldb/include/lldb/Interpreter/CommandObject.h
    M lldb/include/lldb/Interpreter/CommandObjectMultiword.h
    M lldb/source/API/SBCommandInterpreter.cpp
    M lldb/source/Breakpoint/BreakpointLocationCollection.cpp
    M lldb/source/Commands/CommandObjectCommands.cpp
    M lldb/source/Commands/CommandObjectMemory.cpp
    M lldb/source/Commands/CommandObjectMultiword.cpp
    M lldb/source/Commands/CommandObjectProcess.cpp
    M lldb/source/Commands/CommandObjectSource.cpp
    M lldb/source/Commands/CommandObjectThread.cpp
    M lldb/source/Interpreter/CommandInterpreter.cpp
    A lldb/test/API/commands/thread/backtrace/Makefile
    A lldb/test/API/commands/thread/backtrace/TestThreadBacktraceRepeat.py
    A lldb/test/API/commands/thread/backtrace/main.cpp

  Log Message:
  -----------
  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 <Return>-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<std::string>.  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




More information about the All-commits mailing list