From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 88069 invoked by alias); 12 Jan 2016 18:26:04 -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 88051 invoked by uid 89); 12 Jan 2016 18:26:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=watch, degree, HContent-Transfer-Encoding:8bit X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 12 Jan 2016 18:26:02 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id 992338E257; Tue, 12 Jan 2016 18:26:01 +0000 (UTC) Received: from valrhona.uglyboxes.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u0CIQ0wf001453 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 12 Jan 2016 13:26:01 -0500 Subject: Re: [PATCH] Fix problem handling colon in linespec, PR breakpoints/18303 To: Doug Evans References: <047d7b6d967a74c69a0529168b2e@google.com> Cc: "gdb-patches@sourceware.org ml" From: Keith Seitz X-Enigmail-Draft-Status: N1110 Message-ID: <56954538.1030007@redhat.com> Date: Tue, 12 Jan 2016 18:26:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <047d7b6d967a74c69a0529168b2e@google.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2016-01/txt/msg00229.txt.bz2 On 01/11/2016 02:34 PM, Doug Evans wrote: > > - a complete test, just cheap and documentary. */ > > - if (strchr (name, '<') == NULL && strchr (name, '(') == NULL) > > - gdb_assert (strchr (name, ':') == NULL); > > - > > Heya. > > The assert is intended to catch (some) violations of this > (from the function comment): > > NAME is guaranteed to not have any scope (no "::") in its name, though > if for example NAME is a template spec then "::" may appear in the > argument list. [snip] > On that I'm kinda ambivalent, but I like having the assert > watch for the stated invariant. > > Thoughts? I missed that comment. [Well, I didn't even look at it. I'm so used to seeing no/minimal comments for symbol searching functions that I seldom even look for them. My bad.] That seems like a reasonable assertion, then, as long as it really does test what it is supposed to. How about: if (strchr (name, '<') == NULL && strchr (name, '(') == NULL) gdb_assert (strstr (name, "::") == NULL); Or something like that? > > diff --git a/gdb/cp-support.c b/gdb/cp-support.c > > index df127c4..a71c6ad 100644 > > --- a/gdb/cp-support.c > > +++ b/gdb/cp-support.c > > @@ -1037,8 +1037,13 @@ cp_find_first_component_aux (const char *name, > > int permissive) > > return strlen (name); > > } > > case '\0': > > - case ':': > > return index; > > + case ':': > > + /* ':' marks a component iff the next character is also a ':'. > > + Otherwise it is probably malformed input. */ > > + if (name[index + 1] == ':') > > + return index; > > + break; > > What if name[index+2] is also ':'? :-) > I don't think that matters at all. It isn't the scope operator in C++ unless it is *two* colons. Not just a single colon. [Note that I believe we are going to have to deal with the general single-colon issue when running this code with abitags, but that's a patch for some other time. Or maybe this patch already mitigates that to a degree. I haven't checked into it at all.] Keith