[Lldb-commits] [PATCH] Move argument globbing to Target::Launch from Platform::LaunchProcess.

Zachary Turner zturner at google.com
Thu Feb 19 16:59:38 PST 2015


Plus, this gives us the flexibility to use this globbing function on things
that don't map to a list of files on disk.  For example, now you can glob a
list of file names in memory or something.  Say for example you want to use
this globber to look for a list of all modules loaded by a running target.

On Thu Feb 19 2015 at 4:55:05 PM Zachary Turner <zturner at google.com> wrote:

> On Thu Feb 19 2015 at 4:42:54 PM Enrico Granata <egranata at apple.com>
> wrote:
>
>> On Feb 19, 2015, at 4:33 PM, Zachary Turner <zturner at google.com> wrote:
>>
>> Is this not something we could solve by writing a function in Host that
>> behaves the way we'd like it to behave on all platforms?
>>
>>
>> I don’t think LLDB should be in the business of trying to pretend to be a
>> shell. The magic of argdumper is that it gets launched via a shell, so the
>> shell does all the magic expansion for us, and we just dump our list of
>> arguments
>> If you wanted to emulate that, you’d essentially be rewriting the bash
>> command-line, nuances, corner cases, caveats and everything
>> There is a program already that does all that, it’s called a shell
>>
>> Also, I am not sure there is a universal all-platforms notion of
>> globbing. IIRC, on Windows, environment is referenced as %ENVVAR%, not
>> $ENVVAR. You’d want to preserve those platform-specific conventions.
>>
> Are we actually planning to allow the use of environment variables in
> these glob expressions?  Or is it just *. syntax?  Because if environment
> variables are allowed, then there's no way to even write a platform
> independent glob expression.  The reason I didn't bring this up earlier is
> because Windows actually can glob with *. so the examples i had seen so far
> would have worked.  If we want to say that you get arbitrary shell
> expansion, then that's going to make tests very hard to write portably, and
> I'm not crazy about the idea of seeing even more platform specific tests
> going in.
>
> So instead, why not just agree on a very simple subset of what the shell
> does -- in particular allow the use of the character set [*.?] and just
> write the glob function ourselves?
>
>
>>
>>   I mean it might be an ugly function, but the idea of passing stuff to
>> an external program is kinda meh.
>>
>>
>> Why?
>>
> Because I'm not convinced we actually need that level of flexibility.
>
>
>>
>>   FWIW launching a process is not a lightweight operation on windows like
>> it is on other platforms, and there's actually noticeable overhead.  So it
>> would be great if we could remove dependencies on external programs.
>>
>>
>> PlatformWindows could very well decide that it does not support globbing
>> if this is such a big deal.
>>
> It does though, just with a different set of rules.  So now any test that
> goes in to test this has to have tests for each platform's shell syntax.
> We should be trying to find abstractions to bring all the platforms
> together IMO, not increasing the separation.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150220/21184a62/attachment.html>


More information about the lldb-commits mailing list