[Lldb-commits] [PATCH] D49866: Fix duplicate suggestions after an ambiguous command

2018-07-26 Thread Raphael Isemann via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL338043: Fix duplicate suggestions after an ambiguous command 
(authored by teemperor, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D49866?vs=157518=157524#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D49866

Files:
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/wrong_commands/TestWrongCommands.py
  lldb/trunk/source/Interpreter/CommandInterpreter.cpp


Index: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/wrong_commands/TestWrongCommands.py
===
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/wrong_commands/TestWrongCommands.py
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/wrong_commands/TestWrongCommands.py
@@ -26,7 +26,7 @@
 self.assertRegexpMatches(result.GetError(), "Ambiguous command 'g'. 
Possible matches:")
 self.assertRegexpMatches(result.GetError(), "gui")
 self.assertRegexpMatches(result.GetError(), "gdb-remote")
-# FIXME: Somehow we get 'gui' and 'gdb-remote' twice in the output.
+self.assertEquals(1, result.GetError().count("gdb-remote"))
 
 @no_debug_info_test
 def test_unknown_command(self):
Index: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
===
--- lldb/trunk/source/Interpreter/CommandInterpreter.cpp
+++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp
@@ -2932,8 +2932,6 @@
   actual_cmd_name_len = cmd_obj->GetCommandName().size();
 }
   } else {
-if (!cmd_obj)
-  cmd_obj = GetCommandObject(next_word, );
 if (cmd_obj) {
   llvm::StringRef cmd_name = cmd_obj->GetCommandName();
   actual_cmd_name_len += cmd_name.size();


Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/wrong_commands/TestWrongCommands.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/wrong_commands/TestWrongCommands.py
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/wrong_commands/TestWrongCommands.py
@@ -26,7 +26,7 @@
 self.assertRegexpMatches(result.GetError(), "Ambiguous command 'g'. Possible matches:")
 self.assertRegexpMatches(result.GetError(), "gui")
 self.assertRegexpMatches(result.GetError(), "gdb-remote")
-# FIXME: Somehow we get 'gui' and 'gdb-remote' twice in the output.
+self.assertEquals(1, result.GetError().count("gdb-remote"))
 
 @no_debug_info_test
 def test_unknown_command(self):
Index: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
===
--- lldb/trunk/source/Interpreter/CommandInterpreter.cpp
+++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp
@@ -2932,8 +2932,6 @@
   actual_cmd_name_len = cmd_obj->GetCommandName().size();
 }
   } else {
-if (!cmd_obj)
-  cmd_obj = GetCommandObject(next_word, );
 if (cmd_obj) {
   llvm::StringRef cmd_name = cmd_obj->GetCommandName();
   actual_cmd_name_len += cmd_name.size();
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D49866: Fix duplicate suggestions after an ambiguous command

2018-07-26 Thread Davide Italiano via Phabricator via lldb-commits
davide accepted this revision.
davide added a comment.
This revision is now accepted and ready to land.

LG. thanks for improving the interface, I think all these cleanups are really 
good.


https://reviews.llvm.org/D49866



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D49866: Fix duplicate suggestions after an ambiguous command

2018-07-26 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor created this revision.

So far lldb is printing this when it finds an ambiguous command:

  (lldb) g
  Ambiguous command 'g'. Possible matches:
  gdb-remote
  gui
  gdb-remote
  gui

The duplicates come from the fact that we call the same query twice with the 
same parameters
and add it to the same list. This patch just removes the second query call to 
`GetCommandObject`.

As `GetCommandObject` is const and the name parameter is also not modified, 
this shouldn't break
anything else. I didn't merge the remaining if statement into the else as I 
think otherwise the
`if obj==nullptr do X else Y` pattern in there becomes hard to recognize.


https://reviews.llvm.org/D49866

Files:
  
packages/Python/lldbsuite/test/functionalities/wrong_commands/TestWrongCommands.py
  source/Interpreter/CommandInterpreter.cpp


Index: source/Interpreter/CommandInterpreter.cpp
===
--- source/Interpreter/CommandInterpreter.cpp
+++ source/Interpreter/CommandInterpreter.cpp
@@ -2932,8 +2932,6 @@
   actual_cmd_name_len = cmd_obj->GetCommandName().size();
 }
   } else {
-if (!cmd_obj)
-  cmd_obj = GetCommandObject(next_word, );
 if (cmd_obj) {
   llvm::StringRef cmd_name = cmd_obj->GetCommandName();
   actual_cmd_name_len += cmd_name.size();
Index: 
packages/Python/lldbsuite/test/functionalities/wrong_commands/TestWrongCommands.py
===
--- 
packages/Python/lldbsuite/test/functionalities/wrong_commands/TestWrongCommands.py
+++ 
packages/Python/lldbsuite/test/functionalities/wrong_commands/TestWrongCommands.py
@@ -26,7 +26,7 @@
 self.assertRegexpMatches(result.GetError(), "Ambiguous command 'g'. 
Possible matches:")
 self.assertRegexpMatches(result.GetError(), "gui")
 self.assertRegexpMatches(result.GetError(), "gdb-remote")
-# FIXME: Somehow we get 'gui' and 'gdb-remote' twice in the output.
+self.assertEquals(1, result.GetError().count("gdb-remote"))
 
 @no_debug_info_test
 def test_unknown_command(self):


Index: source/Interpreter/CommandInterpreter.cpp
===
--- source/Interpreter/CommandInterpreter.cpp
+++ source/Interpreter/CommandInterpreter.cpp
@@ -2932,8 +2932,6 @@
   actual_cmd_name_len = cmd_obj->GetCommandName().size();
 }
   } else {
-if (!cmd_obj)
-  cmd_obj = GetCommandObject(next_word, );
 if (cmd_obj) {
   llvm::StringRef cmd_name = cmd_obj->GetCommandName();
   actual_cmd_name_len += cmd_name.size();
Index: packages/Python/lldbsuite/test/functionalities/wrong_commands/TestWrongCommands.py
===
--- packages/Python/lldbsuite/test/functionalities/wrong_commands/TestWrongCommands.py
+++ packages/Python/lldbsuite/test/functionalities/wrong_commands/TestWrongCommands.py
@@ -26,7 +26,7 @@
 self.assertRegexpMatches(result.GetError(), "Ambiguous command 'g'. Possible matches:")
 self.assertRegexpMatches(result.GetError(), "gui")
 self.assertRegexpMatches(result.GetError(), "gdb-remote")
-# FIXME: Somehow we get 'gui' and 'gdb-remote' twice in the output.
+self.assertEquals(1, result.GetError().count("gdb-remote"))
 
 @no_debug_info_test
 def test_unknown_command(self):
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits