From: "Doug Evans" <dje@google.com>
To: gdb@sourceware.org
Subject: Re: protection from dangling pointers in dwarf info when .so's go away
Date: Thu, 13 Dec 2007 08:16:00 -0000 [thread overview]
Message-ID: <e394668d0712130016t70af7e4dgefa188b07907d8b@mail.gmail.com> (raw)
In-Reply-To: <20071213032724.GA25868@caradoc.them.org>
On Dec 12, 2007 7:27 PM, Daniel Jacobowitz <drow@false.org> wrote:
> On Wed, Dec 12, 2007 at 05:57:58PM -0800, Doug Evans wrote:
> > Is it the case that vptr_basetype for myclass should never have gotten
> > assigned a value pointing into a .so (or any other obstack)?
>
> Sounds likely to me, but may not be practical.
>
> > Or is
> > gdb supposed to have cleaned up after itself when the .so data got
> > freed?
>
> We do this for user variables when their objfile goes away, by
> recursively copying their type. We don't walk types from other
> objfiles looking for pointers, so there really shouldn't be any.
>
> > Or something else? Any guidance on where the fix should go is
> > appreciated. I suppose an easy solution is to toss out all info, not
> > just for .so's, though that will slow down re-runs.
>
> No, that's impossible. Remember dlopen and dlclose.
Righto, and thanks.
It seems like check_typedef is aware of the issue:
/* [...] We can't create pointers between
types allocated to different objfiles, since they may
have different lifetimes. [...] */
but fill_in_vptr_fieldno is not:
void
fill_in_vptr_fieldno (struct type *type)
{
CHECK_TYPEDEF (type);
if (TYPE_VPTR_FIELDNO (type) < 0)
{
int i;
/* We must start at zero in case the first (and only) baseclass
is virtual (and hence we cannot share the table pointer). */
for (i = 0; i < TYPE_N_BASECLASSES (type); i++)
{
struct type *baseclass = check_typedef (TYPE_BASECLASS (type,
i));
fill_in_vptr_fieldno (baseclass);
if (TYPE_VPTR_FIELDNO (baseclass) >= 0)
{
TYPE_VPTR_FIELDNO (type) = TYPE_VPTR_FIELDNO (baseclass);
TYPE_VPTR_BASETYPE (type) = TYPE_VPTR_BASETYPE (baseclass);
break;
}
}
}
}
What happens if TYPE_OBJFILE (type) != TYPE_OBJFILE
(TYPE_VPTR_BASETYPE (baseclass)) ?
next prev parent reply other threads:[~2007-12-13 8:16 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-13 1:58 Doug Evans
2007-12-13 3:27 ` Daniel Jacobowitz
2007-12-13 8:16 ` Doug Evans [this message]
2007-12-13 13:19 ` Daniel Jacobowitz
2007-12-13 16:56 ` Jim Blandy
2007-12-14 0:04 ` 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=e394668d0712130016t70af7e4dgefa188b07907d8b@mail.gmail.com \
--to=dje@google.com \
--cc=gdb@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