[Lldb-commits] [lldb] r196949 - Fix autocompletion for multi-word commands.

Greg Clayton gclayton at apple.com
Tue Dec 10 11:14:04 PST 2013


Author: gclayton
Date: Tue Dec 10 13:14:04 2013
New Revision: 196949

URL: http://llvm.org/viewvc/llvm-project?rev=196949&view=rev
Log:
Fix autocompletion for multi-word commands.

<rdar://problem/14183288>


Modified:
    lldb/trunk/source/Commands/CommandObjectMultiword.cpp
    lldb/trunk/source/Interpreter/CommandInterpreter.cpp
    lldb/trunk/source/Target/ThreadPlanStepThrough.cpp

Modified: lldb/trunk/source/Commands/CommandObjectMultiword.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMultiword.cpp?rev=196949&r1=196948&r2=196949&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectMultiword.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectMultiword.cpp Tue Dec 10 13:14:04 2013
@@ -235,18 +235,19 @@ CommandObjectMultiword::HandleCompletion
     // completers will override this.
     word_complete = true;
     
+    const char *arg0 = input.GetArgumentAtIndex(0);
     if (cursor_index == 0)
     {
         CommandObject::AddNamesMatchingPartialString (m_subcommand_dict, 
-                                                      input.GetArgumentAtIndex(0), 
+                                                      arg0,
                                                       matches);
 
         if (matches.GetSize() == 1
             && matches.GetStringAtIndex(0) != NULL
-            && strcmp (input.GetArgumentAtIndex(0), matches.GetStringAtIndex(0)) == 0)
+            && strcmp (arg0, matches.GetStringAtIndex(0)) == 0)
         {
             StringList temp_matches;
-            CommandObject *cmd_obj = GetSubcommandObject (input.GetArgumentAtIndex(0), 
+            CommandObject *cmd_obj = GetSubcommandObject (arg0,
                                                           &temp_matches);
             if (cmd_obj != NULL)
             {
@@ -270,7 +271,7 @@ CommandObjectMultiword::HandleCompletion
     }
     else
     {
-        CommandObject *sub_command_object = GetSubcommandObject (input.GetArgumentAtIndex(0), 
+        CommandObject *sub_command_object = GetSubcommandObject (arg0,
                                                                  &matches);
         if (sub_command_object == NULL)
         {

Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=196949&r1=196948&r2=196949&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Tue Dec 10 13:14:04 2013
@@ -1929,12 +1929,19 @@ CommandInterpreter::HandleCompletionMatc
             && matches.GetStringAtIndex(0) != NULL
             && strcmp (parsed_line.GetArgumentAtIndex(0), matches.GetStringAtIndex(0)) == 0)
         {
-            look_for_subcommand = true;
-            num_command_matches = 0;
-            matches.DeleteStringAtIndex(0);
-            parsed_line.AppendArgument ("");
-            cursor_index++;
-            cursor_char_position = 0;
+            if (parsed_line.GetArgumentCount() == 1)
+            {
+                word_complete = true;
+            }
+            else
+            {
+                look_for_subcommand = true;
+                num_command_matches = 0;
+                matches.DeleteStringAtIndex(0);
+                parsed_line.AppendArgument ("");
+                cursor_index++;
+                cursor_char_position = 0;
+            }
         }
     }
 
@@ -2023,7 +2030,7 @@ CommandInterpreter::HandleCompletion (co
         const char *current_elem = partial_parsed_line.GetArgumentAtIndex(cursor_index);
         if (cursor_char_position == 0 || current_elem[cursor_char_position - 1] != ' ')
         {
-            parsed_line.InsertArgumentAtIndex(cursor_index + 1, "", '"');
+            parsed_line.InsertArgumentAtIndex(cursor_index + 1, "", '\0');
             cursor_index++;
             cursor_char_position = 0;
         }

Modified: lldb/trunk/source/Target/ThreadPlanStepThrough.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepThrough.cpp?rev=196949&r1=196948&r2=196949&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanStepThrough.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepThrough.cpp Tue Dec 10 13:14:04 2013
@@ -161,7 +161,7 @@ ThreadPlanStepThrough::ShouldStop (Event
     // First, did we hit the backstop breakpoint?
     if (HitOurBackstopBreakpoint())
     {
-        SetPlanComplete(true);
+        SetPlanComplete(false);
         return true;
     }
 





More information about the lldb-commits mailing list