This is the mail archive of the
mailing list for the GDB project.
Re: c++ debugging hosed
- From: Daniel Berlin <dan at cgsoftware dot com>
- To: Daniel Jacobowitz <drow at mvista dot com>
- Cc: Benjamin Kosnik <bkoz at redhat dot com>, Eli Zaretskii <eliz at is dot elta dot co dot il>, <jason at redhat dot com>, <libstdc++ at gcc dot gnu dot org>, <gdb at sources dot redhat dot com>
- Date: Mon, 26 Nov 2001 19:53:24 -0500 (EST)
- Subject: Re: c++ debugging hosed
On Mon, 26 Nov 2001, Daniel Jacobowitz wrote:
> On Sun, Nov 25, 2001 at 03:29:08PM -0500, Daniel Berlin wrote:
> > On Sun, 25 Nov 2001, Benjamin Kosnik wrote:
> > >
> > > > No, it's relevant to STABS, too.
> > > > It's due to not properly searching virtual baseclasses.
> > > > I might still have the changes to do that somewhere, if someone wants
> > > > them.
> > >
> > > This has been broken for some time now. I'd appreciate it if it got
> > > fixed, so that C++ could be debugged properly.
> > I'm sure a lot of people would.
> > Unfortunately, it appears I don't have the code i had worked up to
> > abstract out the base class offset finding anymore.
> > What's happening is that GDB wants to know the baseclass offset, and
> > the routine it uses is tuned to either gnu-v2 or hp aCC (it checks
> > for something only hp's debug readers fill in, and if it doesn't find
> > it, it assumes gnu-v2), and the gnu-v2 code either returns the wrong
> > value (weird errors occur), or -1, which gives you "virtual baseclass
> > botch"/attempts to deref int values as pointers.
> > baseclass_offset needs to be abstracted into the cp abi model, and all
> > existing uses need to use it.
> Could you clarify what symptom this fix you're discussing is supposed
> to solve? I thought it was the one I was working on, but
> baseclass_offset actually does nothing ABI specific at all.
I'm also quite confused how you can say this after looking at it:
/* First look for the virtual baseclass pointer
in the fields. */
for (i = n_baseclasses; i < len; i++)
if (vb_match (type, i, basetype))
= unpack_pointer (TYPE_FIELD_TYPE (type, i),
valaddr + (TYPE_FIELD_BITPOS (type, i) /
return addr - (LONGEST) address;
Then looking above it at vb_match.
It's, in fact, the most abi specific stuff still left for C++.
It happens to basically work for non-virtual classes, but it couldn't
possibly work for virtual baseclasses (IE even if you pulled some magic in gcc to make
it still output the things vb_match was looking for, it wouldn't work
baseclass offset finding is a fundamental piece of C++ support in gdb.
It's required for printing things, calling methods, etc.