Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Doug Evans <dje@google.com>
To: Tom Tromey <tromey@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFC] Fission patch 1/2
Date: Fri, 13 Apr 2012 17:30:00 -0000	[thread overview]
Message-ID: <CADPb22TjLnt5y7AzvhfQ5aZvyAu+jtW07W-1TkPu5SgPPzZsHQ@mail.gmail.com> (raw)
In-Reply-To: <87iph3y39k.fsf@fleche.redhat.com>

On Fri, Apr 13, 2012 at 10:01 AM, Tom Tromey <tromey@redhat.com> wrote:
>>>>>> "Doug" == Doug Evans <dje@google.com> writes:
>
> Doug> +void
> Doug> +nullify_cleanup (struct cleanup *cleanup)
> Doug> +{
> Doug> +  struct cleanup *c;
> Doug> +
> Doug> +  for (c = cleanup_chain; c->next != cleanup; c = c->next)
> Doug> +    continue;
> Doug> +  c->function = null_cleanup;
> Doug> +}
>
> I'd rather not have a general facility for this kind of thing in
> cleanups.  I think it makes them even harder to reason about.  Instead
> the problem can be solved locally by making the particular cleanup work
> conditionally.

I wonder if to some, but not complete, extent (*1) cleanups are more
fragile than necessary because the API is more fragile than necessary.
My intent was the opposite, but ok, such is life.

[(*1) insert C++ vs C war :-)]

> Doug> +   FIXME: As an implementation detail between our callers and us,
> Doug> +   USE_EXISTING_CU and KEEP are OK.  But bubbling them up into their callers
> Doug> +   isn't as clean as I'd like.  Having more callers with good names
> Doug> +   may be the way to go.  */
>
> I'd just remove it.

"works for me"

> Doug> +  if (free_cu_cleanup != NULL)
>
> This sort of check is dangerous.  A call to make_cleanup can return NULL
> in some situations -- not this particular situation, but if someone
> later modifies the code this can break.
>
> It is better to keep a separate flag.

That sounds pretty odd (and error prone).  Are there *useful*
situations in which make_cleanup can return NULL?  Is it only the
first one?  It feels like it would be cleaner if that were never true,
and thus the users needn't have a separate flag, and thus can be
simpler (and thus the intuitive choice isn't the wrong thing to do).

> Doug> +   The CU "per_cu" pointer is needed because offset alone is not enough to
> Doug> +   uniquely identify the type.  A file may have multiple .debug_types sections,
> Doug> +   or the type may come from a DWO file.
>
> I wonder if this fixes PR 13627.

I didn't know the PR, but it did feel like a bug fix for that exact situation.


  reply	other threads:[~2012-04-13 17:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-13  7:44 Doug Evans
2012-04-13 17:12 ` Tom Tromey
2012-04-13 17:30   ` Doug Evans [this message]
2012-04-13 18:11     ` Tom Tromey
2012-04-13 19:46       ` Doug Evans

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=CADPb22TjLnt5y7AzvhfQ5aZvyAu+jtW07W-1TkPu5SgPPzZsHQ@mail.gmail.com \
    --to=dje@google.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@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