Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Keith Seitz <keiths@redhat.com>
To: "gdb-patches@sourceware.org ml" <gdb-patches@sourceware.org>
Subject: Re: [RFA] Fix number lexing, again
Date: Mon, 30 Jul 2012 16:42:00 -0000	[thread overview]
Message-ID: <5016B972.3060804@redhat.com> (raw)
In-Reply-To: <5016B87B.8070004@redhat.com>

[-- 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.

  reply	other threads:[~2012-07-30 16:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-30 16:38 Keith Seitz
2012-07-30 16:42 ` Keith Seitz [this message]
2012-07-30 17:13 ` Tom Tromey
2012-07-30 18:06   ` Keith Seitz
2012-07-30 22:45     ` asmwarrior

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=5016B972.3060804@redhat.com \
    --to=keiths@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /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