From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tom Tromey To: Michael Snyder Cc: gdb-patches@sources.redhat.com Subject: Re: RFC: Inferior command line arguments Date: Fri, 28 Sep 2001 11:32:00 -0000 Message-id: <877kuji2b7.fsf@creche.redhat.com> References: <87zo7gq7gb.fsf@creche.redhat.com> <3BB4C04D.22C3DAB5@cygnus.com> X-SW-Source: 2001-09/msg00426.html >>>>> "Michael" == Michael Snyder writes: >> gdb --args program arg1 arg2 ... argN >> gdb program --args arg1 arg2 ... argN Michael> Without having read thru your patch, how are you able to Michael> distinguish between args that are intended for GDB (such as Michael> "program" above), and args that are intended for the Michael> inferior? You have "program" appearing both before and after Michael> the "--args" flag. How are you picking it out as special? Michael> How will you pick out other args that are intended for GDB Michael> and not for the inferior, such as "-nw"? 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. I think most people, especially script writers, will end up using `--': gdb --args -- gdb -nw This invokes gdb on `gdb -nw'. The `--' processing is a built-in feature of GNU getopt. It seemed easiest to take advantage of it, since it already exists and is standard across tools. I'm happy to change this to whatever we can agree is reasonable. My primary desire is to have a way to add something to the start of a command line (in a script or elsewhere) that will cause gdb to use the remaining arguments as the program. Right now that is spelled `gdb --args --', but other approaches would be fine by me. Tom