[Lldb-commits] [lldb] r117617 - in /lldb/trunk/source/Commands: CommandObjectCommands.cpp CommandObjectHelp.cpp

Caroline Tice ctice at apple.com
Thu Oct 28 16:17:48 PDT 2010


Author: ctice
Date: Thu Oct 28 18:17:48 2010
New Revision: 117617

URL: http://llvm.org/viewvc/llvm-project?rev=117617&view=rev
Log:
Add  alias information, including aliased command options & 
arguments, to help text for alias commands.


Modified:
    lldb/trunk/source/Commands/CommandObjectCommands.cpp
    lldb/trunk/source/Commands/CommandObjectHelp.cpp

Modified: lldb/trunk/source/Commands/CommandObjectCommands.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectCommands.cpp?rev=117617&r1=117616&r2=117617&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectCommands.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectCommands.cpp Thu Oct 28 18:17:48 2010
@@ -339,6 +339,7 @@
                          if (!result.Succeeded() && result.GetStatus() != lldb::eReturnStatusStarted)
                         {
                             result.AppendError ("Unable to create requested command alias.\n");
+                            return false;
                         }
                      }
 
@@ -378,6 +379,7 @@
              {
                  result.AppendErrorWithFormat ("'%s' is not an existing command.\n", actual_command.c_str());
                  result.SetStatus (eReturnStatusFailed);
+                 return false;
              }
         }
 

Modified: lldb/trunk/source/Commands/CommandObjectHelp.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectHelp.cpp?rev=117617&r1=117616&r2=117617&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectHelp.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectHelp.cpp Thu Oct 28 18:17:48 2010
@@ -69,6 +69,8 @@
         // Get command object for the first command argument. Only search built-in command dictionary.
         StringList matches;
         cmd_obj = m_interpreter.GetCommandObject (command.GetArgumentAtIndex (0), &matches);
+        bool is_alias_command = m_interpreter.AliasExists (command.GetArgumentAtIndex (0));
+        std::string alias_name = command.GetArgumentAtIndex(0);
         
         if (cmd_obj != NULL)
         {
@@ -155,6 +157,13 @@
                     result.SetStatus (eReturnStatusSuccessFinishNoResult);
                 }
             }
+            
+            if (is_alias_command)
+            {
+                StreamString sstr;
+                m_interpreter.GetAliasHelp (alias_name.c_str(), cmd_obj->GetCommandName(), sstr);
+                result.GetOutputStream().Printf ("\n'%s' is an abbreviation for %s\n", alias_name.c_str(), sstr.GetData());
+            }
         }
         else if (matches.GetSize() > 0)
         {





More information about the lldb-commits mailing list