[Lldb-commits] Fix for double command completion text

Kopec, Matt matt.kopec at intel.com
Fri Jun 14 12:15:13 PDT 2013


Hi Matthew,

I ran this patch against the lldb test suite and a regression came up. Here is how to quickly run the failing test and the corresponding output:

mkopec1 at mkopec1-linux:~/dev/llvm/tools/lldb/test$ python dotest.py --executable /home/mkopec1/dev/llvm/build/Debug+Asserts/bin/lldb -q -p TestAliases.py
UNSUPPORTED: LLDB (clang-x86_64) :: test_with_dsym (TestAliases.AliasTestCase) (requires Darwin) 
FAIL: LLDB (clang-x86_64) :: test_with_dwarf (TestAliases.AliasTestCase)
======================================================================
FAIL: test_with_dwarf (TestAliases.AliasTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/mkopec1/dev/llvm/tools/lldb/test/lldbtest.py", line 368, in wrapper
    return func(self, *args, **kwargs)
  File "/home/mkopec1/dev/llvm/tools/lldb/test/functionalities/alias/TestAliases.py", line 24, in test_with_dwarf
    self.alias_tests ()
  File "/home/mkopec1/dev/llvm/tools/lldb/test/functionalities/alias/TestAliases.py", line 139, in alias_tests
    self.runCmd ("alias exprf2 expr --raw -f %1 --")
  File "/home/mkopec1/dev/llvm/tools/lldb/test/lldbtest.py", line 1582, in runCmd
    msg if msg else CMD_MSG(cmd))
AssertionError: False is not True : Command 'alias exprf2 expr --raw -f %1 --' returns successfully
Config=x86_64-clang
----------------------------------------------------------------------
Ran 2 tests in 0.633s

FAILED (failures=1, skipped=1)

Matt

On 2013-06-07, at 5:24 PM, Matthew Sorrels <sorrels.m at gmail.com> wrote:

> When doing command completion with multiple command matches you will see the commands twice.  The best example of this bug is typing pl<tab>
> 
> (lldb) pl
> Available completions:
>     platform
>     plugin
>     platform
>     plugin
> 
> 
> with this patch you get the expected result:
> 
> (lldb) pl
> Available completions:
>     platform
>     plugin
> 
> 
> The fix works because once an exact match for a command and a command+aliases fails it just asks for any inexact matches from both commands and aliases rather than asking for any inexact commands (which returns a list of matches) and then any inexact commands and aliases (which adds the commands to the list again plus any aliases).
> 
> If this seems reasonable, please commit it for me.  Thanks.
> 
> 
> Index: source/Interpreter/CommandInterpreter.cpp
> ===================================================================
> --- source/Interpreter/CommandInterpreter.cpp    (revision 183564)
> +++ source/Interpreter/CommandInterpreter.cpp    (working copy)
> @@ -848,13 +848,7 @@
>          command_obj = GetCommandSP (cmd_cstr, true, true, matches).get();
>      }
>  
> -    // If there wasn't an exact match among the aliases, look for an inexact match
> -    // in just the commands.
> -
> -    if (command_obj == NULL)
> -        command_obj = GetCommandSP(cmd_cstr, false, false, matches).get();
> -
> -    // Finally, if there wasn't an inexact match among the commands, look for an inexact
> +    // If there wasn't an exact match among the commands and aliases, look for an inexact
>      // match in both the commands and aliases.
>      if (command_obj == NULL)
>          command_obj = GetCommandSP(cmd_cstr, true, false, matches).get();
> 
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits





More information about the lldb-commits mailing list