Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Keith Seitz <keiths@redhat.com>
To: gdb-patches ml <gdb-patches@sourceware.org>
Cc: Hui Zhu <teawater@gmail.com>
Subject: Re: [PATCH Bug breakpoints/14381] Fix linespec to parse file name that begin with decimal numbers
Date: Wed, 25 Jul 2012 21:21:00 -0000	[thread overview]
Message-ID: <50106327.5000004@redhat.com> (raw)
In-Reply-To: <CANFwon0SkNBVcLxf+PqyUzZyQJLhnPPzhPm=9qC9xAO8547Rmw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2124 bytes --]

On 07/25/2012 05:56 AM, Hui Zhu wrote:

>>>> 2012-07-24  Hui Zhu  <hui_zhu@mentor.com>
>>>>       * linespec.c (linespec_lexer_lex_number): Update comments,
>>>>       change the return and add check to make sure the input is
>>>>       the decimal numbers.
>>>>       (linespec_lexer_lex_one): If linespec_lexer_lex_number return
>>>>       false, call linespec_lexer_lex_string.

This patch caused several regressions:

FAIL: gdb.base/dprintf.exp: dprintf 26,"arg=%d, g=%d\n", arg, g (got 
interactive prompt)
FAIL: gdb.base/dprintf.exp: 1st dprintf, gdb
FAIL: gdb.base/dprintf.exp: 2nd dprintf, gdb
FAIL: gdb.base/dprintf.exp: 1st dprintf, call
FAIL: gdb.base/dprintf.exp: 2nd dprintf, call
FAIL: gdb.base/dprintf.exp: 1st dprintf, fprintf
FAIL: gdb.base/dprintf.exp: 2nd dprintf, fprintf
FAIL: gdb.base/list.exp: list range; filename:line1,filename:line2
FAIL: gdb.base/list.exp: list range; line1,line2
FAIL: gdb.base/list.exp: list range; upper bound past EOF
FAIL: gdb.base/list.exp: list range; both bounds past EOF
FAIL: gdb.base/list.exp: list range, must be same files
FAIL: gdb.linespec/ls-errs.exp: break 3:
FAIL: gdb.linespec/ls-errs.exp: break +10:
FAIL: gdb.linespec/ls-errs.exp: break -10:
FAIL: gdb.linespec/ls-errs.exp: break 3:
FAIL: gdb.linespec/ls-errs.exp: break +10:
FAIL: gdb.linespec/ls-errs.exp: break -10:
FAIL: gdb.linespec/ls-errs.exp: break 3	:
FAIL: gdb.linespec/ls-errs.exp: break +10	:
FAIL: gdb.linespec/ls-errs.exp: break -10	:
FAIL: gdb.linespec/ls-errs.exp: break 3	:
FAIL: gdb.linespec/ls-errs.exp: break +10	:
FAIL: gdb.linespec/ls-errs.exp: break -10	:
ERROR: (DejaGnu) proc "all tests in this module will fail.\"" does not 
exist. (backtrace.exp)

This happens because numeric tokens may be terminated by a comma or 
colon (in addition to whitespace).

The attached patch fixes these regressions (and fixes a typo in the 
comment for linespec_lexer_lex_one).

Ok for HEAD and 7.5?

Keith

ChangeLog
2012-07-25  Keith Seitz  <keiths@redhat.com>

         * linespec.c (linespec_lexer_lex_number): The input
         is also a valid number if the next character is a comma
	or colon.

[-- Attachment #2: lex_number-comma.patch --]
[-- Type: text/x-patch, Size: 1013 bytes --]

diff --git a/gdb/linespec.c b/gdb/linespec.c
index c72bb4b..9218db4 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -366,7 +366,8 @@ static const char *const linespec_quote_characters = "\"\'";
 /* Lexer functions.  */
 
 /* Lex a number from the input in PARSER.  This only supports
-   decimal numbers.\
+   decimal numbers.
+
    Return true if input is decimal numbers.  Return false if not.  */
 
 static int
@@ -389,7 +390,11 @@ linespec_lexer_lex_number (linespec_parser *parser, linespec_token *tokenp)
       ++(PARSER_STREAM (parser));
     }
 
-  if (*PARSER_STREAM (parser) != '\0' && !isspace(*PARSER_STREAM (parser)))
+  /* If the next character in the input buffer is not a space, comma,
+     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) = LS_TOKEN_STOKEN (*tokenp).ptr;
       return 0;

  reply	other threads:[~2012-07-25 21:21 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-22  6:30 Hui Zhu
2012-07-22  7:11 ` Jan Kratochvil
2012-07-22  8:55   ` Hui Zhu
2012-07-22 10:11     ` Hui Zhu
2012-07-22 10:52       ` Jan Kratochvil
2012-07-23 14:26       ` Tom Tromey
2012-07-23 18:04         ` Keith Seitz
2012-07-22 14:12 ` Keith Seitz
2012-07-22 14:48   ` Hui Zhu
2012-07-23 14:28     ` Tom Tromey
2012-07-23 17:17       ` Keith Seitz
2012-07-24  3:48       ` Hui Zhu
2012-07-24 19:36         ` Tom Tromey
2012-07-25 12:57           ` Hui Zhu
2012-07-25 21:21             ` Keith Seitz [this message]
2012-07-26 13:52               ` Tom Tromey
2012-07-26 18:21                 ` Keith Seitz

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=50106327.5000004@redhat.com \
    --to=keiths@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=teawater@gmail.com \
    /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