Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Doug Evans <dje@google.com>
To: Keith Seitz <keiths@redhat.com>
Cc: "gdb-patches@sourceware.org ml" <gdb-patches@sourceware.org>
Subject: Re: [RFA 5/9] Explicit locations v2 - Add probe locations
Date: Sun, 03 Aug 2014 00:22:00 -0000	[thread overview]
Message-ID: <CADPb22TQBGydXAb2RUpUaxu5SOVoV-M22FbuK20UfUCTcOZi8w@mail.gmail.com> (raw)
In-Reply-To: <21469.30354.662367.622712@ruffy.mtv.corp.google.com>

On Sat, Aug 2, 2014 at 4:38 PM, Doug Evans <dje@google.com> wrote:
> [...]
>  > diff --git a/gdb/probe.c b/gdb/probe.c
>  > index c7597d9..2ff5d86 100644
>  > --- a/gdb/probe.c
>  > +++ b/gdb/probe.c
>  > @@ -58,7 +58,8 @@ parse_probes (struct event_location *location,
>  >    result.sals = NULL;
>  >    result.nelts = 0;
>  >
>  > -  arg_start = EVENT_LOCATION_LINESPEC (location);
>  > +  gdb_assert (EVENT_LOCATION_TYPE (location) == PROBE_LOCATION);
>  > +  arg_start = EVENT_LOCATION_PROBE (location);
>  >
>  >    cs = arg_start;
>  >    probe_ops = probe_linespec_to_ops (&cs);
>  > @@ -173,12 +174,12 @@ parse_probes (struct event_location *location,
>  >      {
>  >        canonical->special_display = 1;
>  >        canonical->pre_expanded = 1;
>  > -      canonical->location = new_linespec_location (NULL);
>  > -      EVENT_LOCATION_LINESPEC (canonical->location)
>  > +      canonical->location = new_probe_location (NULL);
>  > +      EVENT_LOCATION_PROBE (canonical->location)
>  >      = savestring (arg_start, arg_end - arg_start);
>
> I see why you pass NULL to new_probe_location and then set EVENT_LOCATION_PROBE
> afterwards (otherwise two copies of the string would be malloc'd, and you'd
> need to deal with freeing one of them).  One could add a version of
> new_probe_location that took a char* and a length, but that seems excessive.
> Another place where c++ would allow cleaner code.

OTOH, is that, or any other variation, excessive?
It's preferable to not have users of object foo know how to physically
construct a foo.

/just a thought for discussion's sake - I wouldn't change the patch if
this is but one of many similar instances, unless it makes sense to
change all of them.


  reply	other threads:[~2014-08-03  0:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-08 18:02 Keith Seitz
2014-05-30 18:19 ` Keith Seitz
2014-08-02 23:39   ` Doug Evans
2014-08-03  0:22     ` Doug Evans [this message]
2014-09-03 19:32     ` 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=CADPb22TQBGydXAb2RUpUaxu5SOVoV-M22FbuK20UfUCTcOZi8w@mail.gmail.com \
    --to=dje@google.com \
    --cc=gdb-patches@sourceware.org \
    --cc=keiths@redhat.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