From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tom Tromey To: deephan@erols.com Cc: gdb-patches@sources.redhat.com Subject: Re: [PATCH] specify arguments to debugee from commandline (second try) Date: Thu, 05 Apr 2001 21:21:00 -0000 Message-id: <87n19uirbk.fsf@creche.redhat.com> References: <20010330005457.A21793@llamedos.org> <20010330163603.A27435@llamedos.org> <20010403013600.B7630@llamedos.org> X-SW-Source: 2001-04/msg00048.html >>>>> "David" == David Deephanphongs writes: David> 1) as an escaped string: My favorite, but no-one else seems to David> like it. I can explain why I don't like it. Sometimes I debug gcc. gcc runs other programs, which are usually the ones I really want to debug. Doing this is currently a pain -- I have to run `gcc -v' and then cut and paste the resulting command line into gdb. Sometimes I find it hard to find the command line I want, and I always find this process annoying. I'd like to modify gcc so I can invoke: `gcj --debug jc1 ...' and have gcc automatically insert `gdb --run' before the jc1 invocation. Then gdb will come up with the arguments magically set. Likewise I'd like to be able to simply insert `gdb --run' into shell scripts or any other program-launching code to get the debugger to do the tedious work for me. If we make the argument to `--run' a single string, then every place I want to do this will have to deal with quoting issues and the like. In places like gcc, where the arguments are already broken out into a vector, I'd have to add special code to reassemble the vector into a string. In shell scripts this is very hard to do. If `--run' accepts multiple arguments, then `gdb --run' can be dropped in to most places with ease. For instance in shell scripts it is just trivial. For something that is manipulating an argument vector, it just means growing the vector by 2 slots. David> 3) like X: when gdb encounters -- on the command line, all the David> following arguments are treated as arguments to the inferior David> process. David> Pro: simple to use. Doesn't change syntax as much as 2. David> Precedent for it already exists. The precedent here is not only in X but also in GNU. GNU getopt already has special handling for `--' arguments. Search for `--' in src/libiberty/getopt.c. David> Con: breaks anything that uses core files that are named "--", David> although that's probably not too likely. It is entirely possible that this case already doesn't work, due to the special handling of `--' in GNU getopt. Has anybody tried it? David> 4) like 3), but with a --args-enable option that turns it on - David> this preserves perfect compatability with all the existing David> scripts. My personal opinion is that this isn't necessary. David> Which way do I need to go to get a patch in? I don't know. You don't have to please me, that's for sure. I offer the above to explain my thinking on the subject. This is a feature I've wanted literally for years. Tom