Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Michael Snyder <msnyder@cygnus.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: RFC: Inferior command line arguments
Date: Fri, 28 Sep 2001 11:32:00 -0000	[thread overview]
Message-ID: <877kuji2b7.fsf@creche.redhat.com> (raw)
In-Reply-To: <3BB4C04D.22C3DAB5@cygnus.com>

>>>>> "Michael" == Michael Snyder <msnyder@cygnus.com> 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


  reply	other threads:[~2001-09-28 11:32 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-27 21:02 Tom Tromey
2001-09-28  1:31 ` Eli Zaretskii
2001-09-28  5:26   ` Tom Tromey
2001-09-28  7:21     ` Eli Zaretskii
2001-09-28  7:50       ` Tom Tromey
2001-09-28  9:25         ` Eli Zaretskii
2001-09-30 12:07           ` Christopher Faylor
2001-10-01  0:39             ` Eli Zaretskii
2001-10-01  8:07               ` Tom Tromey
2001-10-01  8:10                 ` Christopher Faylor
2001-09-28 11:24 ` Michael Snyder
2001-09-28 11:32   ` Tom Tromey [this message]
2001-09-28 11:59     ` Daniel Jacobowitz
2001-09-28 12:24       ` Tom Tromey
2001-09-29  2:23         ` Eli Zaretskii
2001-09-28 12:27       ` Andrew Cagney
2001-09-28 12:42         ` Daniel Jacobowitz
2001-09-28 14:19           ` Tom Tromey
2001-09-28 14:22             ` Daniel Jacobowitz
2001-09-29  1:23             ` David Deephanphongs
2001-10-01  8:09               ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877kuji2b7.fsf@creche.redhat.com \
    --to=tromey@redhat.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=msnyder@cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox