This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [rfa] Make get_number_or_range accept value history references
- From: Pedro Alves <pedro at codesourcery dot com>
- To: gdb-patches at sourceware dot org
- Cc: Michael Snyder <msnyder at vmware dot com>
- Date: Fri, 25 Feb 2011 11:55:56 +0000
- Subject: Re: [rfa] Make get_number_or_range accept value history references
- References: <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