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:
> In my current code, `--args' changes the interpretation of non-option
> arguments. It doesn't stop argument processing. If you want that
> then you have to use `--' as well.
>
> So:
>
> gdb --args gdb -nw
>
> is a confusing way of writing:
>
> gdb -nw --args gdb
>
> This happens because GNU getopt reorders options as it processes the
> command line.
>
> It might be possible to have `--args' stop all other argument
> processing. I haven't investigated that.
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.
--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer