This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: RFC: Inferior command line arguments
> On Fri, Sep 28, 2001 at 12:43:24PM -0600, Tom Tromey wrote:
> Rather than continue down this path, I'd much rather see us fix or fork
> GNU getopt so that we can detect the presence of '--'; I'd think in
> fact we could do it without having to go through all these hoops, but I
> haven't actually looked at the code. If nothing else, this should be
> possible:
>
> - scan the command line for '--'
> - if found, save what's after as an inferior argv vector
> - shrink argv so it stops before the '--'
> - go through normal existing getopt loop
> and optionally:
> - if we found a program name, tack it on at the beginning of the
> inferior argv; if we didn't, grab one from the beginning of the
> inferior argv.
>
> The use of -- is pretty standard; I'd like us to support it if we
> could.
Unfortunatly ``--'' already has certain semantics. Detecting it
wouldn't be sufficient. Consider things like:
--argument-expected --
-- --poor-programe-name-choice --poor-core-file-choice
gdb --args -- gdb --args -- program arg arg
Tom's --args -- is somewhat grotesque but at least it is well defined.
Something like:
gdb --- gdb --- program arg arg
might be possible but it is really sugar for ``--args --''.
Andrew