[Lldb-commits] [lldb] r180114 - Fix linux argument completion with for "--" options (llvm.org/bugs/pr14425)
Daniel Malea
daniel.malea at intel.com
Tue Apr 23 08:28:10 PDT 2013
Author: dmalea
Date: Tue Apr 23 10:28:10 2013
New Revision: 180114
URL: http://llvm.org/viewvc/llvm-project?rev=180114&view=rev
Log:
Fix linux argument completion with for "--" options (llvm.org/bugs/pr14425)
Patch by Yacine Belkadi!
When __GLIBC__ is defined, optind gets initialized to 0. So for the first parsed
option, parse_start is 0, too. If this option has no argument (Like "--continue"
of "process attach"), then the position stored is 0, instead of 1. This prevents
the completion later on in Options::HandleOptionCompletion() because the opt_pos
doesn't match the cursor_index.
Fix that by getting the option's position from the value of optind, as it's done
for the other types of options.
Re-enable test_process_attach_dash_dash_con() on Linux.
No regressions detected on Mac OS X (in TestCompletion.py)
Modified:
lldb/trunk/source/Interpreter/Args.cpp
lldb/trunk/test/functionalities/completion/TestCompletion.py
Modified: lldb/trunk/source/Interpreter/Args.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/Args.cpp?rev=180114&r1=180113&r2=180114&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/Args.cpp (original)
+++ lldb/trunk/source/Interpreter/Args.cpp Tue Apr 23 10:28:10 2013
@@ -1507,7 +1507,6 @@ Args::ParseArgsForCompletion
while (1)
{
bool missing_argument = false;
- int parse_start = optind;
int long_options_index = -1;
val = ::getopt_long_only (dummy_vec.size() - 1,
@@ -1601,7 +1600,7 @@ Args::ParseArgsForCompletion
switch (long_options[long_options_index].has_arg)
{
case no_argument:
- option_element_vector.push_back (OptionArgElement (opt_defs_index, parse_start, 0));
+ option_element_vector.push_back (OptionArgElement (opt_defs_index, optind - 1, 0));
break;
case required_argument:
if (optarg != NULL)
Modified: lldb/trunk/test/functionalities/completion/TestCompletion.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/completion/TestCompletion.py?rev=180114&r1=180113&r2=180114&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/completion/TestCompletion.py (original)
+++ lldb/trunk/test/functionalities/completion/TestCompletion.py Tue Apr 23 10:28:10 2013
@@ -29,7 +29,6 @@ class CommandLineCompletionTestCase(Test
"""Test that 'de' completes to 'detach '."""
self.complete_from_to('de', 'detach ')
- @expectedFailureLinux # PR-14425: completion broken for strings that begin with --
def test_process_attach_dash_dash_con(self):
"""Test that 'process attach --con' completes to 'process attach --continue '."""
self.complete_from_to('process attach --con', 'process attach --continue ')
More information about the lldb-commits
mailing list