Re: [RFA/c++] Fix printing classes with virtual base classes

Daniel Jacobowitz
2001-11-27T13:26:00Z

They are both independent fixes. The fixes to gnu-v3-abi.c by
themselves fix several tests in virtfunc.exp when using G++ 3.0
(from XFAIL to XPASS, ugh...). Then if you look at the test logs, you
should find two failure modes for the ones that still fail. Some are
marked "virtual baseclass botch", and I am trying right now to fix
those; but I believe that one will just be wrong. That's because my
use of value_field in gnuv3_virtual_fn_field triggers the bug; the
value has not been read in yet, so only its address is copied, and the
embedded offset for the parent type is lost. We then get the wrong
vtable and call the wrong function.

I can't construct an independent testcase, but I think it should be
possible. Most things run afoul of the other "botch" bug.

On Tue, Nov 27, 2001 at 04:17:51PM -0500, Jim Blandy wrote:
>
> These are two independent fixes, right? I understand GDB may need
> them both before it works correctly; I'm asking if each of them is a
> correct change in its own right. If so, could you show me a test case
> that each change fixes?
>
> Daniel Jacobowitz <drow@mvista.com> writes:
> > 2001-11-26 Daniel Jacobowitz <drow@mvista.com>
> >
> > * values.c (value_primitive_field): Add embedded_offset to the
> > address of structure members.
> > * gnu-v3-abi.c (gnuv3_rtti_type): Cast to base type before
> > attempting to access vtable pointer. Set using_enc_p if we cast.
> > (gnuv3_virtual_fn_field): Call value_cast with structure rather than
> > structure pointer. Cast to base type before attempting to access
> > vtable pointer.
>

--
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer