[Lldb-commits] [lldb] r373053 - [lldb] Print an error message for an empty subcommand

Raphael Isemann via lldb-commits lldb-commits at lists.llvm.org
Fri Sep 27 01:49:41 PDT 2019


Author: teemperor
Date: Fri Sep 27 01:49:41 2019
New Revision: 373053

URL: http://llvm.org/viewvc/llvm-project?rev=373053&view=rev
Log:
[lldb] Print an error message for an empty subcommand

Modified:
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/multiword-commands/TestMultiWordCommands.py
    lldb/trunk/source/Commands/CommandObjectMultiword.cpp

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/multiword-commands/TestMultiWordCommands.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/multiword-commands/TestMultiWordCommands.py?rev=373053&r1=373052&r2=373053&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/multiword-commands/TestMultiWordCommands.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/multiword-commands/TestMultiWordCommands.py Fri Sep 27 01:49:41 2019
@@ -20,8 +20,7 @@ class MultiwordCommandsTestCase(TestBase
 
     @no_debug_info_test
     def test_empty_subcommand(self):
-        # FIXME: This has no error message.
-        self.expect("platform \"\"", error=True)
+        self.expect("platform \"\"", error=True, substrs=["Need to specify a non-empty subcommand."])
 
     @no_debug_info_test
     def test_help(self):

Modified: lldb/trunk/source/Commands/CommandObjectMultiword.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMultiword.cpp?rev=373053&r1=373052&r2=373053&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectMultiword.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectMultiword.cpp Fri Sep 27 01:49:41 2019
@@ -94,8 +94,10 @@ bool CommandObjectMultiword::Execute(con
   }
 
   auto sub_command = args[0].ref();
-  if (sub_command.empty())
+  if (sub_command.empty()) {
+    result.AppendError("Need to specify a non-empty subcommand.");
     return result.Succeeded();
+  }
 
   if (sub_command.equals_lower("help")) {
     this->CommandObject::GenerateHelpText(result);




More information about the lldb-commits mailing list