[Lldb-commits] [lldb] r180117 - Look for an inexact match in just the commands before searching the alias commands as well.

jingham at apple.com jingham at apple.com
Tue Apr 23 13:08:14 PDT 2013


The "expr" alias wasn't pointless.  There were two commands: exit and expression that were ambiguous up to "ex".  Adding "expr" meant that "expression" and "expr" were ambiguous up to "exp".  That was silly given that the "expr" alias added nothing.

To be handled properly, the command resolution when faced with "exp" would have to find that there was an alias "expr" and the command "expression", then check that "expr" and "expression" were in fact the same command, which you would determine by looking up the "expr" alias and seeing if it had any alias options.  If it did, then the two would be ambiguous.  If it didn't it is safe to treat them as the same.  But doing this seemed overkill, so we just removed the pointless "expr" alias.

Jim


On Apr 23, 2013, at 1:02 PM, "Kopec, Matt" <matt.kopec at intel.com> wrote:

> I noticed that commit from Sean but 'expr' continues to work for me. Otherwise I think there are tests that still use 'expr' and would have started failing since they weren't updated. Or was some other use of 'expr' removed?
> 
> On 2013-04-23, at 3:35 PM, Enrico Granata <egranata at apple.com<mailto:egranata at apple.com>>
> wrote:
> 
> I am not sure about the logic of the test case, but I do remember that we removed the “expr” alias a few days ago.
> The rationale was that having both expression and exp made commands like
> (lldb) exp 1 + 2
> ambiguous (is exp == expr or == expression) for no good actual reason - and we avoided tackling the general issue of checking for “alias equality” as a potential ambiguity solver.
> Just a data point - not sure how helpful.
> 
> Enrico Granata
> ✉ egranata@.com
> ✆ 27683
> 
> On Apr 23, 2013, at 12:05 PM, "Kopec, Matt" <matt.kopec at intel.com<mailto:matt.kopec at intel.com>> wrote:
> 
> Sorry, I should have mentioned it in the commit message.
> 
> There was a failure in TestAliases.py where if you alias the command 'expr' twice, the second alias fails because the command interpreter failed to return the CommandSP for 'expr'. What actually happened is GetCommandSP returns a list of matches (2 in this case) if there is more than one match. So it would find 'expr' and the first alias for expr. I added a call to only return CommandSP for command (if one is found, since that is the one I want) and then search aliases after if nothing could be found.
> 
> Does that seem reasonable?
> 
> Thanks,
> Matt
> 
> On 2013-04-23, at 2:53 PM, <jingham at apple.com<mailto:jingham at apple.com>>
> wrote:
> 
> Matt,
> 
> What was this fixing?
> 
> Jim
> 
> On Apr 23, 2013, at 9:17 AM, Matt Kopec <Matt.Kopec at intel.com<mailto:Matt.Kopec at intel.com>> wrote:
> 
> Author: mkopec
> Date: Tue Apr 23 11:17:32 2013
> New Revision: 180117
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=180117&view=rev
> Log:
> Look for an inexact match in just the commands before searching the alias commands as well.
> 
> 
> Modified:
> lldb/trunk/source/Interpreter/CommandInterpreter.cpp
> 
> Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=180117&r1=180116&r2=180117&view=diff
> ==============================================================================
> --- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original)
> +++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Tue Apr 23 11:17:32 2013
> @@ -848,10 +848,15 @@ CommandInterpreter::GetCommandObject (co
>      command_obj = GetCommandSP (cmd_cstr, true, true, matches).get();
>  }
> 
> -    // Finally, if there wasn't an exact match among the aliases, look for an inexact match
> -    // in both the commands and the aliases.
> +    // 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
> +    // match in both the commands and aliases.
> +    if (command_obj == NULL)
>      command_obj = GetCommandSP(cmd_cstr, true, false, matches).get();
> 
>  return command_obj;
> 
> 
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at cs.uiuc.edu<mailto:lldb-commits at cs.uiuc.edu>
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
> 
> 
> 
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at cs.uiuc.edu<mailto:lldb-commits at cs.uiuc.edu>
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits





More information about the lldb-commits mailing list