[Lldb-commits] [PATCH] D81241: [lldb] Tab completion for `frame recognizer delete`

Raphael Isemann via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Jun 30 04:51:23 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rGc37d25f0d1e0: [lldb] Tab completion for `frame recognizer delete` (authored by MrHate, committed by teemperor).
Herald added a subscriber: lldb-commits.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81241

Files:
  lldb/source/Commands/CommandObjectFrame.cpp
  lldb/test/API/functionalities/completion/TestCompletion.py


Index: lldb/test/API/functionalities/completion/TestCompletion.py
===================================================================
--- lldb/test/API/functionalities/completion/TestCompletion.py
+++ lldb/test/API/functionalities/completion/TestCompletion.py
@@ -421,6 +421,10 @@
         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):
Index: lldb/source/Commands/CommandObjectFrame.cpp
===================================================================
--- lldb/source/Commands/CommandObjectFrame.cpp
+++ lldb/source/Commands/CommandObjectFrame.cpp
@@ -936,6 +936,33 @@
 
   ~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) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81241.274424.patch
Type: text/x-patch
Size: 2146 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200630/22a05aa5/attachment.bin>


More information about the lldb-commits mailing list