Re: [Core] [RFC] dwarf debug information: Handle Free Pascal virtual table indexes

Tom Tromey
2010-05-14T16:19:32Z

>>>>> "Jonas" == Jonas Maebe <jonas.maebe@elis.ugent.be> writes:

>> So I guess we can safely try to reuse the existing C++ branch in the
>> DWARF reader for the Pascal case.

Jonas> I agree. And I assume it is currently not used because we don't
Jonas> generate an AT_containing_type attribute (because that's used by
Jonas> GDB's DWARF parser to initialise fnp->fcontext). That should not
Jonas> be too difficult to add, but I'm not sure what it's doing in the
Jonas> debug info as part of a TAG_subprogram.

I misread the code a little yesterday -- I didn't notice that the
existing code is stripping an initial DW_OP_ref. So I think if FPC
emitted correct DWARF, gdb would already handle it. Well, maybe
... there is a "fnp->voffset += 2" in there that I don't understand the
rationale for.

The AT_containing_type stuff seems to be some historical relic in gcc.
The reason it is important now is that it is the way gdb recognizes that
it should use a gcc-specific hack.

Jonas> As far as I can see, it's only defined by the DWARF3 spec for
Jonas> DW_TAG_ptr_to_member_type entries (which are not supported by
Jonas> GDB, and I'm not entirely sure about what their purpose is).

They are for the C++ pointer-to-member feature. GDB doesn't implement
these because GCC doesn't emit them, preferring instead another
GCC-specific hack :-(. There is a PR in GCC bugzilla for this too.

Tom