Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: msnyder@vmware.com (Michael Snyder)
Cc: gdb-patches@sourceware.org (gdb-patches@sourceware.org)
Subject: Re: [RFA] dwarf2loc.c, loclist_read_variable, Assert frame not null
Date: Fri, 04 Mar 2011 23:34:00 -0000	[thread overview]
Message-ID: <201103042334.p24NYOIV032112@d06av02.portsmouth.uk.ibm.com> (raw)
In-Reply-To: <4D7169A9.4000207@vmware.com> from "Michael Snyder" at Mar 04, 2011 02:37:29 PM

Michael Snyder wrote:

> Now, I've heard a rumor that frame-infos can never be null.
> 
> If that's true, then instead of this patch, we should just
> delete the earlier check for null.

It's not quite that simple -- with the ->read_variable callbacks,
there are two classes of symbols: those that can only be evaluated
relative to a frame, and those that can be evaluated without any
reference to a frame (e.g. globals).

For the latter, it is valid to pass a NULL frame argument to the
->read_variable callback, while it is invalid for the former.  To
distinguish between the two, the caller is supposed to call the
->read_needs_frame callback before calling ->read_variable.

However, in the particular case of *location list* symbols, we
currently always require a frame anyway.  See the corresponding 
->read_needs_frame implementation:

static int
loclist_read_needs_frame (struct symbol *symbol)
{
  /* If there's a location list, then assume we need to have a frame
     to choose the appropriate location expression.  With tracking of
     global variables this is not necessarily true, but such tracking
     is disabled in GCC at the moment until we figure out how to
     represent it.  */

  return 1;
}


So, given this situation, I'd suggest to remove the check for a
NULL frame in loclist_read_variable, and replace it with a global
assertion that frame is non-NULL -- but with a comment refering
to the explanation in loclist_read_needs_frame for this specific
case ...

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


  reply	other threads:[~2011-03-04 23:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-04 22:37 Michael Snyder
2011-03-04 23:34 ` Ulrich Weigand [this message]
2011-03-05  0:00 ` Pedro Alves
2011-03-05  0:12   ` Michael Snyder

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=201103042334.p24NYOIV032112@d06av02.portsmouth.uk.ibm.com \
    --to=uweigand@de.ibm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=msnyder@vmware.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