* [RFA] Fix number lexing, again
@ 2012-07-30 16:38 Keith Seitz
2012-07-30 16:42 ` Keith Seitz
2012-07-30 17:13 ` Tom Tromey
0 siblings, 2 replies; 5+ messages in thread
From: Keith Seitz @ 2012-07-30 16:38 UTC (permalink / raw)
To: gdb-patches@sourceware.org ml; +Cc: asmwarrior
[-- Attachment #1: Type: text/plain, Size: 675 bytes --]
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.
[-- Attachment #2: lex_number-quotes.patch --]
[-- Type: text/x-patch, Size: 782 bytes --]
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;
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [RFA] Fix number lexing, again
2012-07-30 16:38 [RFA] Fix number lexing, again Keith Seitz
@ 2012-07-30 16:42 ` Keith Seitz
2012-07-30 17:13 ` Tom Tromey
1 sibling, 0 replies; 5+ messages in thread
From: Keith Seitz @ 2012-07-30 16:42 UTC (permalink / raw)
To: gdb-patches@sourceware.org ml
[-- Attachment #1: Type: text/plain, Size: 382 bytes --]
On 07/30/2012 09:38 AM, Keith Seitz wrote:
Gah! This time with the tests included!
> ChangeLog
> 2012-07-30 Keith Seitz <keiths@redhat.com>
>
> * linespec.c (linespec_lex_number): A number followed
> by quotes is a valid number, too.
testsuite/ChangeLog
2012-07-30 Keith Seitz <keiths@redhat.com>
* gdb.linespec/ls-errs.exp: Check some quote-enclosed
linespecs.
[-- Attachment #2: lex_number-quotes.patch --]
[-- Type: text/x-patch, Size: 1355 bytes --]
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;
diff --git a/gdb/testsuite/gdb.linespec/ls-errs.exp b/gdb/testsuite/gdb.linespec/ls-errs.exp
index 7db8ae4..5668397 100644
--- a/gdb/testsuite/gdb.linespec/ls-errs.exp
+++ b/gdb/testsuite/gdb.linespec/ls-errs.exp
@@ -146,6 +146,8 @@ add the_tests "$srcfile:3 foo" unexpected_opt "string" "foo"
foreach x $invalid_offsets {
add the_tests "$srcfile:$x" invalid_offset_f $x $srcfile
+ add the_tests "\"$srcfile:$x\"" invalid_offset_f $x $srcfile
+ add the_tests "'$srcfile:$x'" invalid_offset_f $x $srcfile
}
# Test invalid filespecs starting with function.
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [RFA] Fix number lexing, again
2012-07-30 16:38 [RFA] Fix number lexing, again Keith Seitz
2012-07-30 16:42 ` Keith Seitz
@ 2012-07-30 17:13 ` Tom Tromey
2012-07-30 18:06 ` Keith Seitz
1 sibling, 1 reply; 5+ messages in thread
From: Tom Tromey @ 2012-07-30 17:13 UTC (permalink / raw)
To: Keith Seitz; +Cc: gdb-patches@sourceware.org ml, asmwarrior
>>>>> "Keith" == Keith Seitz <keiths@redhat.com> writes:
Keith> While the list of growing terminations for the string is getting
Keith> tediously long, I don't think inverting the test would be any
Keith> shorter/clearer. WDYT?
I agree.
The patch is ok; so is the test suite patch.
Keith> PS. Also recommending this for 7.5.
Yes please.
Tom
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFA] Fix number lexing, again
2012-07-30 17:13 ` Tom Tromey
@ 2012-07-30 18:06 ` Keith Seitz
2012-07-30 22:45 ` asmwarrior
0 siblings, 1 reply; 5+ messages in thread
From: Keith Seitz @ 2012-07-30 18:06 UTC (permalink / raw)
To: gdb-patches@sourceware.org ml; +Cc: asmwarrior
On 07/30/2012 10:13 AM, Tom Tromey wrote:
>>>>>> "Keith" == Keith Seitz <keiths@redhat.com> writes:
>
> Keith> While the list of growing terminations for the string is getting
> Keith> tediously long, I don't think inverting the test would be any
> Keith> shorter/clearer. WDYT?
>
> I agree.
> The patch is ok; so is the test suite patch.
>
> Keith> PS. Also recommending this for 7.5.
>
> Yes please.
All committed. Thank you!
Keith
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-07-30 22:45 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-30 16:38 [RFA] Fix number lexing, again Keith Seitz
2012-07-30 16:42 ` Keith Seitz
2012-07-30 17:13 ` Tom Tromey
2012-07-30 18:06 ` Keith Seitz
2012-07-30 22:45 ` asmwarrior
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox