From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 43726 invoked by alias); 19 Mar 2015 12:18:40 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 43711 invoked by uid 89); 19 Mar 2015 12:18:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Thu, 19 Mar 2015 12:18:39 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 22701D36E9; Thu, 19 Mar 2015 08:18:35 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id y276PWJaO76Z; Thu, 19 Mar 2015 08:18:35 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 13455D36E1; Thu, 19 Mar 2015 08:18:34 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 9DC0640EAD; Thu, 19 Mar 2015 08:18:34 -0400 (EDT) Date: Thu, 19 Mar 2015 12:18:00 -0000 From: Joel Brobecker To: Keith Seitz Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 1/2] Whitespace terminates keywords in the linespec parser. Message-ID: <20150319121834.GC4884@adacore.com> References: <20150317205942.9650.84728.stgit@valrhona.uglyboxes.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150317205942.9650.84728.stgit@valrhona.uglyboxes.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2015-03/txt/msg00582.txt.bz2 Hi Keith, > This patch changes the linespec lexer so that any keyword seen > in the input stream is only a keyword if the next character is > whitespace (as opposed to a non-identifier character). > > As a result, the lexer and find_condition_and_thread will both > share the same keyword-terminal behavior. > > gdb/ChangeLog > > * linespec.c (linespec_lexer_lex_keyword): According to > find_condition_and_thread, keywords must be followed by > whitespace. Follow that requirement here. I think you know this code better than anyone, but what about testing for the nul character as well? I'm guessing that, many times, a keyword at the end of the linespec is going to result in an invalid linespec, but it's still a keyword? > --- > gdb/linespec.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/gdb/linespec.c b/gdb/linespec.c > index 9ec4a5e..597df87 100644 > --- a/gdb/linespec.c > +++ b/gdb/linespec.c > @@ -433,10 +433,9 @@ linespec_lexer_lex_keyword (const char *p) > int len = strlen (linespec_keywords[i]); > > /* If P begins with one of the keywords and the next > - character is not a valid identifier character, > - we have found a keyword. */ > + character is whitespace, we have found a keyword. */ > if (strncmp (p, linespec_keywords[i], len) == 0 > - && !(isalnum (p[len]) || p[len] == '_')) > + && isspace (p[len])) > return linespec_keywords[i]; > } > } -- Joel