Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "J. Johnston" <jjohnstn@redhat.com>
To: Andrew Cagney <ac131313@redhat.com>
Cc: Elena Zannoni <ezannoni@redhat.com>, gdb-patches@sources.redhat.com
Subject: Re: RFA: gdb/783 doc change
Date: Tue, 12 Nov 2002 09:27:00 -0000	[thread overview]
Message-ID: <3DD13A16.246D1B21@redhat.com> (raw)
In-Reply-To: <3DD12509.4090003@redhat.com>

Andrew Cagney wrote:
> 
> > J. Johnston writes:
> >  > The following changes the mi documentation to clarify the usage of the
> >  > "--" delimeter.  This delimeter is meant to provide a way to separate
> >  > options from parameters so as to handle cases whereby the parameters may
> >  > start with "-" and be mistaken for options.
> 
> >  > The problem reported tries to use it generally before any parameter list.
> >  > This doesn't work because only the mi_getopt option processor knows to ignore it and
> >  > commands that don't have options (preceded by dash) don't call mi_getopt.
> >  > It is then treated as a parameter which is incorrect.
> 
> >  > I have removed the delimeter from the description of the -data-disassemble
> >  > command as it is not manditory and the delimeter should be treated as optional to all
> >  > applicable commands that support both options and parameters.  I have removed
> >  > it from one of the -data-disassemble examples to clarify that it may or may not
> >  > be specified.
> 
> The documentation is correct, there is no reason for changing it.
> 
> All MI commands should use mi_getopt() as by doing this the MI can
> present a very consistent command line interface to its users.  Contrast
> this to the UNIX and GDB CLI interfaces, each individual command has its
> own eseoteric edge conditions (and the user needs to work around each
> individually).  The ``--'' problem is just one of the cases that
> mi_getopt() handles, another is c-strings (see below).
> 
> In case you're wondering, the commands that don't use mi_getopt()
> pre-date that function's implementation (and one has gone back and
> updated them).
> 
> For the most part converting commands to use mi_getopt() should be
> straight forward.  There are exceptions though, some of the older
> commands pulled a very GDB CLI like hack by accepting:
>         -command -opt x this is the "final" parameter
> when they should have accepted:
>         -command -opt x -- "this is the \"final\" parameter"
> such a change will get messy and might mean replacing the command.
> 

Could you please clarify this?  The mi_getopt code currently returns -1
when it sees a "--" or an argument that does not start with a "-".  It
sets optind to 1 so you can skip over the "--", but it is not
used to do any parsing of regular parameters beyond the option list.

Could you also clarify what you want to do with commands that currently
do not accept options.  For example, -data-disassemble only accepts parameters.
If the command is not changed to accept options, then you just want the
mi_getopt for the sake of skipping the "--".  If correct, this seems wasteful.
I can't imagine why an application would want or need to call a command this way.

-- Jeff J.


  parent reply	other threads:[~2002-11-12 17:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-11 17:15 J. Johnston
2002-11-11 17:15 ` Elena Zannoni
2002-11-12  7:58   ` Andrew Cagney
2002-11-12  8:55     ` J. Johnston
2002-11-12  9:27     ` J. Johnston [this message]
2002-11-12  8:48   ` J. Johnston
2002-11-12 10:16   ` Eli Zaretskii

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=3DD13A16.246D1B21@redhat.com \
    --to=jjohnstn@redhat.com \
    --cc=ac131313@redhat.com \
    --cc=ezannoni@redhat.com \
    --cc=gdb-patches@sources.redhat.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