[Lldb-commits] [lldb] c418f00 - [lldb] Fix completion of 'settings set' values

Dave Lee via lldb-commits lldb-commits at lists.llvm.org
Mon Sep 26 11:26:29 PDT 2022


Author: Dave Lee
Date: 2022-09-26T11:26:13-07:00
New Revision: c418f00536001169f40d09bf3bff568aacfc9c30

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

LOG: [lldb] Fix completion of 'settings set' values

Some time ago, a refactor (1153dc960) broke completion for assigning settings
values (`settings set`). This was most annoying for enum settings, where you'd
have to get the valid enum names separately.

This restores the logic in the post-refactor completion function, as well as
adding a test to catch future regressions.

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

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/lldb/source/Commands/CommandObjectSettings.cpp b/lldb/source/Commands/CommandObjectSettings.cpp
index 86194664bf5dc..9420beaad372b 100644
--- a/lldb/source/Commands/CommandObjectSettings.cpp
+++ b/lldb/source/Commands/CommandObjectSettings.cpp
@@ -154,7 +154,7 @@ insert-before or insert-after.");
       return;
 
     // Complete option name
-    if (arg[0] != '-')
+    if (arg[0] == '-')
       return;
 
     // Complete setting value

diff  --git a/lldb/test/API/functionalities/completion/TestCompletion.py b/lldb/test/API/functionalities/completion/TestCompletion.py
index 49950e0cec13a..f2d3fb704900a 100644
--- a/lldb/test/API/functionalities/completion/TestCompletion.py
+++ b/lldb/test/API/functionalities/completion/TestCompletion.py
@@ -405,6 +405,11 @@ def test_settings_set_target_process_thread_dot(self):
                               ['target.process.thread.step-avoid-regexp',
                                'target.process.thread.trace-thread'])
 
+    def test_settings_set_can_complete_setting_enum_values(self):
+        """Checks that we can complete the values of an enum setting."""
+        self.complete_from_to('settings set stop-disassembly-display ',
+                              ['never', 'always', 'no-debuginfo', 'no-source'])
+
     def test_thread_plan_discard(self):
         self.build()
         (_, _, thread, _) = lldbutil.run_to_source_breakpoint(self,


        


More information about the lldb-commits mailing list