[Lldb-commits] [PATCH] D134515: [lldb] Fix completion of 'settings set' values

Dave Lee via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Sep 22 21:18:31 PDT 2022


kastiglione created this revision.
kastiglione added reviewers: mib, augusto2112.
Herald added a project: All.
kastiglione requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D134515

Files:
  lldb/source/Commands/CommandObjectSettings.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
@@ -405,6 +405,12 @@
                               ['target.process.thread.step-avoid-regexp',
                                'target.process.thread.trace-thread'])
 
+    def test_settings_set_stop_disassembly_display_value(self):
+        """Test that 'settins set stop-disassembly-display ' completes to [
+        'never', 'always', 'no-debuginfo', 'no-source']."""
+        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,
Index: lldb/source/Commands/CommandObjectSettings.cpp
===================================================================
--- lldb/source/Commands/CommandObjectSettings.cpp
+++ lldb/source/Commands/CommandObjectSettings.cpp
@@ -154,7 +154,7 @@
       return;
 
     // Complete option name
-    if (arg[0] != '-')
+    if (arg[0] == '-')
       return;
 
     // Complete setting value


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134515.462390.patch
Type: text/x-patch
Size: 1306 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220923/4dae6a60/attachment.bin>


More information about the lldb-commits mailing list