[Lldb-commits] [PATCH] Move argument globbing to Target::Launch from Platform::LaunchProcess.
egranata at apple.com
Thu Feb 19 17:01:41 PST 2015
> On Feb 19, 2015, at 4:55 PM, Zachary Turner <zturner at google.com> wrote:
> On Thu Feb 19 2015 at 4:42:54 PM Enrico Granata <egranata at apple.com <mailto:egranata at apple.com>> wrote:
>> On Feb 19, 2015, at 4:33 PM, Zachary Turner <zturner at google.com <mailto: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?
Unless there’s a compelling reason not to, yes.
The launch-via-shell currently allows that, and it’s a nice feature.
With that said, this is exactly why this thing belongs in Platform. Different platforms have different features. If an OS existed without * expansions, or without environment variables, then these things would not be supported when launching on that platform.
> Or is it just *. syntax? Because if environment variables are allowed, then there's no way to even write a platform independent glob expression.
Which is fine, because you most likely know what remote system you’re talking to when debugging.
> 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 just don’t see the value of doing more work for less feature.
>> I mean it might be an ugly function, but the idea of passing stuff to an external program is kinda meh.
> 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.
That which will be part of testing the platform-specific bits of your platform
📩 egranata@.com ☎️ 27683
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the lldb-commits