[Lldb-commits] [lldb] c37d25f - [lldb] Tab completion for `frame recognizer delete`
Raphael Isemann via lldb-commits
lldb-commits at lists.llvm.org
Tue Jun 30 04:50:38 PDT 2020
Author: Gongyu Deng
Date: 2020-06-30T13:50:14+02:00
New Revision: c37d25f0d1e059b39fbbc1ccc9f52ddba42be6b9
URL: https://github.com/llvm/llvm-project/commit/c37d25f0d1e059b39fbbc1ccc9f52ddba42be6b9
DIFF: https://github.com/llvm/llvm-project/commit/c37d25f0d1e059b39fbbc1ccc9f52ddba42be6b9.diff
LOG: [lldb] Tab completion for `frame recognizer delete`
Summary: Provided tab completion for command `frame recognizer delete`.
Reviewers: teemperor, JDevlieghere
Reviewed By: teemperor, JDevlieghere
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D81241
Added:
Modified:
lldb/source/Commands/CommandObjectFrame.cpp
lldb/test/API/functionalities/completion/TestCompletion.py
Removed:
################################################################################
diff --git a/lldb/source/Commands/CommandObjectFrame.cpp b/lldb/source/Commands/CommandObjectFrame.cpp
index 9ad4e3238359..5677b1612bee 100644
--- a/lldb/source/Commands/CommandObjectFrame.cpp
+++ b/lldb/source/Commands/CommandObjectFrame.cpp
@@ -936,6 +936,33 @@ class CommandObjectFrameRecognizerDelete : public CommandObjectParsed {
~CommandObjectFrameRecognizerDelete() override = default;
+ void
+ HandleArgumentCompletion(CompletionRequest &request,
+ OptionElementVector &opt_element_vector) override {
+ if (request.GetCursorIndex() != 0)
+ return;
+
+ StackFrameRecognizerManager::ForEach(
+ [&request](uint32_t rid, std::string rname, std::string module,
+ llvm::ArrayRef<lldb_private::ConstString> symbols,
+ bool regexp) {
+ StreamString strm;
+ if (rname.empty())
+ rname = "(internal)";
+
+ strm << rname;
+ if (!module.empty())
+ strm << ", module " << module;
+ if (!symbols.empty())
+ for (auto &symbol : symbols)
+ strm << ", symbol " << symbol;
+ if (regexp)
+ strm << " (regexp)";
+
+ request.TryCompleteCurrentArg(std::to_string(rid), strm.GetString());
+ });
+ }
+
protected:
bool DoExecute(Args &command, CommandReturnObject &result) override {
if (command.GetArgumentCount() == 0) {
diff --git a/lldb/test/API/functionalities/completion/TestCompletion.py b/lldb/test/API/functionalities/completion/TestCompletion.py
index b9ddba30a5e4..0cec206025d1 100644
--- a/lldb/test/API/functionalities/completion/TestCompletion.py
+++ b/lldb/test/API/functionalities/completion/TestCompletion.py
@@ -421,6 +421,10 @@ def test_frame_select(self):
lldbutil.run_to_source_breakpoint(self, '// Break here', self.main_source_spec)
self.complete_from_to('frame select ', ['0'])
+
+ def test_frame_recognizer_delete(self):
+ self.runCmd("frame recognizer add -l py_class -s module_name -n recognizer_name")
+ self.check_completion_with_desc('frame recognizer delete ', [['0', 'py_class, module module_name, symbol recognizer_name']])
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24489")
def test_symbol_name(self):
More information about the lldb-commits
mailing list