[Lldb-commits] [lldb] 2e65332 - [lldb] tab completion for `watchpoint set variable`

Raphael Isemann via lldb-commits lldb-commits at lists.llvm.org
Tue Aug 11 00:52:14 PDT 2020


Author: Gongyu Deng
Date: 2020-08-11T09:51:55+02:00
New Revision: 2e653327e364aae564209af99d3b6a4625e25b68

URL: https://github.com/llvm/llvm-project/commit/2e653327e364aae564209af99d3b6a4625e25b68
DIFF: https://github.com/llvm/llvm-project/commit/2e653327e364aae564209af99d3b6a4625e25b68.diff

LOG: [lldb] tab completion for `watchpoint set variable`

1. Applied the common completion `eVariablePathCompletion` to command
`watchpoint set variable`;

2. Added a related test case.

Reviewed By: teemperor, JDevlieghere

Differential Revision: https://reviews.llvm.org/D84177

Added: 
    

Modified: 
    lldb/source/Commands/CommandObjectWatchpoint.cpp
    lldb/test/API/functionalities/completion/TestCompletion.py

Removed: 
    


################################################################################
diff  --git a/lldb/source/Commands/CommandObjectWatchpoint.cpp b/lldb/source/Commands/CommandObjectWatchpoint.cpp
index c2a008af79d6..390e24195c9f 100644
--- a/lldb/source/Commands/CommandObjectWatchpoint.cpp
+++ b/lldb/source/Commands/CommandObjectWatchpoint.cpp
@@ -823,6 +823,16 @@ corresponding to the byte size of the data type.");
 
   ~CommandObjectWatchpointSetVariable() override = default;
 
+  void
+  HandleArgumentCompletion(CompletionRequest &request,
+                           OptionElementVector &opt_element_vector) override {
+    if (request.GetCursorIndex() != 0)
+      return;
+    CommandCompletions::InvokeCommonCompletionCallbacks(
+        GetCommandInterpreter(), CommandCompletions::eVariablePathCompletion,
+        request, nullptr);
+  }
+
   Options *GetOptions() override { return &m_option_group; }
 
 protected:

diff  --git a/lldb/test/API/functionalities/completion/TestCompletion.py b/lldb/test/API/functionalities/completion/TestCompletion.py
index da66f896e135..a57dbdbd22ea 100644
--- a/lldb/test/API/functionalities/completion/TestCompletion.py
+++ b/lldb/test/API/functionalities/completion/TestCompletion.py
@@ -209,6 +209,13 @@ def test_watchpoint_set_var(self):
         """Test that 'watchpoint set var' completes to 'watchpoint set variable '."""
         self.complete_from_to('watchpoint set var', 'watchpoint set variable ')
 
+    def test_watchpoint_set_variable_foo(self):
+        self.build()
+        lldbutil.run_to_source_breakpoint(self, '// Break here', lldb.SBFileSpec("main.cpp"))
+        self.complete_from_to('watchpoint set variable fo', 'watchpoint set variable fooo')
+        # Only complete the first argument.
+        self.complete_from_to('watchpoint set variable fooo ', 'watchpoint set variable fooo ')
+
     def test_help_fi(self):
         """Test that 'help fi' completes to ['file', 'finish']."""
         self.complete_from_to(


        


More information about the lldb-commits mailing list