This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PR c++/19406
On Fri, Feb 11, 2005 at 04:11:30PM -0500, Jason Merrill wrote:
> >> > Basically, I think it's wrong to try to emit just one field of a class.
> >> > If we need a field for some reason, then we need the entire class to put
> >> > it in proper context.
> >>
> >> The idea of this optimization is that we will emit the entire class in some
> >> file, but in others just emit enough of a husk to emit the defined member.
> >> This husk is marked incomplete, so the debugger knows to look elsewhere for
> >> the full definition of the class.
> >
> > But do any debuggers actually handle this? I don't think GDB will.
>
> My impression was that GDB handled it fine. This optimization was
> non-controversial when it went in.
With a.C:
struct A
{
virtual int foo();
double d, e, f;
};
struct B : public A
{
A::d;
};
B b;
int main ()
{
}
and b.C:
struct A
{
virtual int foo();
double d, e, f;
};
int A::foo () { }
and my http://gcc.gnu.org/ml/gcc-patches/2005-01/msg01115.html
patch GDB knows that A has d, e and f fields, where they are located etc.,
although a.o contains only:
<1><40>: Abbrev Number: 2 (DW_TAG_structure_type)
DW_AT_sibling : <69>
DW_AT_name : A
DW_AT_declaration : 1
<2><48>: Abbrev Number: 3 (DW_TAG_member)
DW_AT_name : d
DW_AT_decl_file : 1
DW_AT_decl_line : 4
DW_AT_type : <69>
DW_AT_data_member_location: 2 byte block: 23 8 (DW_OP_plus_uconst: 8)
<2><54>: Abbrev Number: 4 (DW_TAG_imported_declaration)
DW_AT_decl_file : 1
DW_AT_decl_line : 9
DW_AT_import : <48>
and only b.o describes the whole A type:
<1><50>: Abbrev Number: 2 (DW_TAG_structure_type)
DW_AT_sibling : <bc>
DW_AT_name : A
DW_AT_byte_size : 32
DW_AT_decl_file : 1
DW_AT_decl_line : 2
DW_AT_containing_type: <50>
<2><5e>: Abbrev Number: 3 (DW_TAG_member)
DW_AT_name : _vptr.A
DW_AT_type : <ce>
DW_AT_data_member_location: 2 byte block: 23 0 (DW_OP_plus_uconst: 0)
DW_AT_artificial : 1
<2><6f>: Abbrev Number: 4 (DW_TAG_member)
DW_AT_name : d
DW_AT_decl_file : 1
DW_AT_decl_line : 4
DW_AT_type : <da>
DW_AT_data_member_location: 2 byte block: 23 8 (DW_OP_plus_uconst: 8)
<2><7b>: Abbrev Number: 4 (DW_TAG_member)
DW_AT_name : e
DW_AT_decl_file : 1
DW_AT_decl_line : 4
DW_AT_type : <da>
DW_AT_data_member_location: 2 byte block: 23 10 (DW_OP_plus_uconst: 16)
<2><87>: Abbrev Number: 4 (DW_TAG_member)
DW_AT_name : f
DW_AT_decl_file : 1
DW_AT_decl_line : 4
DW_AT_type : <da>
DW_AT_data_member_location: 2 byte block: 23 18 (DW_OP_plus_uconst: 24)
Jakub