This is the mail archive of the
gdb-patches@sourceware.cygnus.com
mailing list for the GDB project.
Re: GDB needs a --cmdline option
OK, we do have a problem with the gdb command line invocation.
We are aware of that and we have not fixed it because:
1) It is not trivial
2) We don't want to make things even worse.
One of the problems is that we have a syntax, well established,
documented everywhere, used in who knows how many scripts,
that has the core file name or the process id following the
executable file specification. That was a mistake, but it was
made long time ago and we have to live with it.
Now people want to:
1) Specify gdb command in the command line.
2) Pass the arguments to the program to be debugged on the gdb
command line.
The first one is not so trivial as it seems because there are some
ordering of command execution that gdb will have to take care of.
We do it for the .gdbinit commands already, but the user will have
to be aware of this detail, unfortunately.
The second one is just a syntax problem. As Andrew says, if we had the
first one implemented you could just use a "set args". But them there
is the globbing issues...
Based on what DJ wrote, we could do something similar to dbx.
gdb <gdb command line switches> -run <command line>
The first token would be the program to run and everything else
would be set as arguments for that program (implicit "set args").
The -run must be (obviously) the last gdb command line switch.
Gdb will silently exit on program exit, with the same return code
as the inferior ended.
Opinions? Volunteers?
DJ Delorie wrote:
>
> > I have been running into a problem with gdb that it seems
> > would be nicely solved with a new command line option --cmdline.
>
> SunOS's debugger could do this:
>
> dbx -r program args ...
>
> *If* there was a problem with the program, the debugger would take
> over. Otherwise, the program ran as usual, and exited as usual, and
> the debugger quietly stayed out of the way.
>
> I used that in Makefiles a lot, and it would really come in handy
> in gcc (-B'dbx -r ./' ?)
--
Fernando Nasser
Red Hat - Toronto E-Mail: fnasser@cygnus.com
2323 Yonge Street, Suite #300 Tel: 416-482-2661 ext. 311
Toronto, Ontario M4P 2C9 Fax: 416-482-6299