[Lldb-commits] [PATCH] D77444: [commands] Support autorepeat in SBCommands

walter erquinigo via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Apr 6 11:57:54 PDT 2020


wallace updated this revision to Diff 255426.
wallace added a comment.
Herald added a subscriber: mgorny.

- Moved the test to gtest. It's much better this way and I learned gtest
- Changed the API. Some notes:

Within the scope of a subcommand, the subcommand doesn't know the parent's
command name. It only knows its own name and it doesn't have any referrence to
its parent. That makes it very difficult to implement an enum option for
eCommandNameRepeat, as @jingham suggested. The GetRepeatCommand signature also
doesn't provide useful info about the parsed arguments.

I took a look at the existing implementations for GetRepeatCommand, and it seems
that most of them just return nullptr, "", or the same command without flags.

I don't want to change any existing core command interpreter function, so I
think that a simple API that covers most of the cases is just providing nullptr
for repeating the same command, "" for not repeating, or a custom string for
any other case. If in the future anyone needs something very customized, a new
override could be created, but I don't think this will happen anytime soon.

Another option is to provide a callback function instead of a string, but I
don't know if it's too much.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D77444/new/

https://reviews.llvm.org/D77444

Files:
  lldb/include/lldb/API/SBCommandInterpreter.h
  lldb/source/API/SBCommandInterpreter.cpp
  lldb/unittests/Interpreter/CMakeLists.txt
  lldb/unittests/Interpreter/TestAutoRepeat.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77444.255426.patch
Type: text/x-patch
Size: 17490 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200406/02fcfb2e/attachment-0001.bin>


More information about the lldb-commits mailing list