Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Keith Seitz <keiths@redhat.com>
To: Doug Evans <dje@google.com>
Cc: "gdb-patches@sourceware.org ml" <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Fix problem handling colon in linespec, PR breakpoints/18303
Date: Tue, 12 Jan 2016 18:26:00 -0000	[thread overview]
Message-ID: <56954538.1030007@redhat.com> (raw)
In-Reply-To: <047d7b6d967a74c69a0529168b2e@google.com>

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


  parent reply	other threads:[~2016-01-12 18:26 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-11 22:34 Doug Evans
2016-01-12  0:17 ` Don Breazeal
2016-01-12 18:26 ` Keith Seitz [this message]
2016-01-25 17:26   ` [PING] " Don Breazeal
2016-01-26 16:56     ` Doug Evans
2016-01-28  1:21       ` [PATCH v2] PR 18303, Tolerate malformed input for lookup_symbol-called functions Don Breazeal
2016-01-28 12:06         ` Pedro Alves
2016-01-28 22:43           ` [PATCH v3] " Don Breazeal
2016-01-28 22:52             ` [PATCH v4] " Don Breazeal
2016-02-04 18:37               ` [PING] " Don Breazeal
2016-02-18 18:22                 ` [PING] Re: [PATCH v4] PR 18303, Tolerate malformed input for lookup_symbol-called functions (was: [PATCH] Fix problem handling colon in linespec, PR breakpoints/18303) Don Breazeal
2016-02-25 17:28                   ` [PING] Re: [PATCH v4] PR 18303, Tolerate malformed input for lookup_symbol-called functions Don Breazeal
2016-03-03 18:19                     ` Don Breazeal
2016-03-14 21:23                       ` [PING] Re: [PATCH v4] PR 18303, Tolerate malformed input for lookup_symbol-called functions (was: Re: [PATCH] Fix problem handling colon in linespec, PR breakpoints/18303) Don Breazeal
2016-03-15 15:55                         ` [PING] Re: [PATCH v4] PR 18303, Tolerate malformed input for lookup_symbol-called functions Pedro Alves
  -- strict thread matches above, loose matches on Subject: below --
2016-01-08 18:44 [PATCH] Fix problem handling colon in linespec, PR breakpoints/18303 Don Breazeal
2016-01-08 23:03 ` Keith Seitz
2016-01-11 19:21   ` Don Breazeal

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=56954538.1030007@redhat.com \
    --to=keiths@redhat.com \
    --cc=dje@google.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