This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [rfa] Make get_number_or_range accept value history references


Pedro Alves wrote:
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?

It's worse than that. I have to think about all the characters that a user might type here, if they didn't know better. Ugh.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]