This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFA] Fix number lexing, again
- From: Keith Seitz <keiths at redhat dot com>
- To: "gdb-patches at sourceware dot org ml" <gdb-patches at sourceware dot org>
- Cc: asmwarrior at gmail dot com
- Date: Mon, 30 Jul 2012 09:38:19 -0700
- Subject: [RFA] Fix number lexing, again
Hi,
As someone pointed out, I did not fix all the corner cases with
linespec_lexer_lex_number. [See
http://sourceware.org/ml/gdb/2012-07/msg00078.html - the issue affects
all platforms]
Since it is still quite common for MI-based UIs to quote the entire
linespec, we need to terminate numbers successfully on any quotation.
While the list of growing terminations for the string is getting
tediously long, I don't think inverting the test would be any
shorter/clearer. WDYT?
Keith
PS. Also recommending this for 7.5.
ChangeLog
2012-07-30 Keith Seitz <keiths@redhat.com>
* linespec.c (linespec_lex_number): A number followed
by quotes is a valid number, too.
diff --git a/gdb/linespec.c b/gdb/linespec.c
index 3d7f62f..51994c8 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -391,10 +391,11 @@ linespec_lexer_lex_number (linespec_parser *parser, linespec_token *tokenp)
}
/* If the next character in the input buffer is not a space, comma,
- or colon, this input does not represent a number. */
+ quote, or colon, this input does not represent a number. */
if (*PARSER_STREAM (parser) != '\0'
&& !isspace (*PARSER_STREAM (parser)) && *PARSER_STREAM (parser) != ','
- && *PARSER_STREAM (parser) != ':')
+ && *PARSER_STREAM (parser) != ':'
+ && !strchr (linespec_quote_characters, *PARSER_STREAM (parser)))
{
PARSER_STREAM (parser) = LS_TOKEN_STOKEN (*tokenp).ptr;
return 0;