This is the mail archive of the
mailing list for the GDB project.
Re: [RFA/c++] Fix printing classes with virtual base classes
Daniel Jacobowitz <firstname.lastname@example.org> writes:
> On Mon, Nov 26, 2001 at 11:39:34PM -0500, Jim Blandy wrote:
> > I'm with you on VALUE_OFFSET and VALUE_EMBEDDED_OFFSET. I'm pretty
> > sure VALUE_OFFSET can be eliminated from GDB entirely, with some minor
> > changes to the representation of subvalues of registers and
> > convenience variables.
> I am exceedingly tempted to do this.
Yeah, wouldn't it be nice if VALUE_ADDRESS returned, oh, say, the
value's address? For register and convenience variable subvalues, use
the value's address field instead of the offset field. I'm pretty
sure VALUE_OFFSET goes away entirely then.
> Gnu v2 code handles this by casting the Baz to a Foo, at which point
> magic happens, and somehow the vptr is visible. This suggests that my
> fix is not the best way of doing it, and I should be using
> TYPE_VPTR_BASETYPE somehow instead. I may need to think some more.
Yeah, I think that's what I was getting at; I wanted to see
TYPE_VPTR_BASETYPE in there somewhere.
> > I wonder if that dereferencing code could be simplified with a
> > judicious use of `lookup_pointer_type (vtable_type)' and
> > `value_deref'...
> I suppose it would read simpler if I took a value_addr () and cast a
> bit. But magic happens in value casting that I don't want to happen.