Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org
Cc: Michael Snyder <msnyder@vmware.com>
Subject: Re: [rfa] Make get_number_or_range accept value history references
Date: Fri, 25 Feb 2011 11:59:00 -0000	[thread overview]
Message-ID: <201102251155.57072.pedro@codesourcery.com> (raw)
In-Reply-To: <4D66AD46.204@vmware.com>

On Thursday 24 February 2011 19:11:02, Michael Snyder wrote:
> +      if (isdigit (h[1]) || h[1] == '\0' || h[1] == ' ' || h[1] == '\t')
> +       /* single-dollar history value */
> +       index = strtol (&h[1], endp, 10);

Is this correct for the ' '  and '\t' cases?  It looks
like it will accept "$ 3" as history value 3, but
it should parsed as "$" -- the last history value.

You're also not checking if the string is all
digits, so $123asdf is being accepted as $123, while
the language parsers treat that as an internal
variable.  Maybe you should take a look at write_dollar_variable,
and factor out or borrow code from there to avoid these
discrepancies?

> +      else if (h[1] == '$' 
> +              && (isdigit (h[2]) || h[2] == '\0'
> +                  || h[2] == ' ' || h[2] == '\t'))
> +       /* double-dollar history value */
> +       index = -strtol (&h[2], endp, 10);

-- 
Pedro Alves


  reply	other threads:[~2011-02-25 11:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-24 19:12 Michael Snyder
2011-02-25 11:59 ` Pedro Alves [this message]
2011-02-25 19:20   ` Michael Snyder
2011-02-25 22:10   ` Michael Snyder
2011-02-26 11:54     ` Pedro Alves
2011-02-27 21:03       ` Michael Snyder

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=201102251155.57072.pedro@codesourcery.com \
    --to=pedro@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=msnyder@vmware.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