This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: C++ debugging progress
- From: Daniel Berlin <dan at cgsoftware dot com>
- To: Daniel Jacobowitz <drow at mvista dot com>
- Cc: Jason Merrill <jason at redhat dot com>, <libstdc++ at gcc dot gnu dot org>, <gdb at sources dot redhat dot com>
- Date: Wed, 28 Nov 2001 13:36:28 -0500 (EST)
- Subject: Re: C++ debugging progress
On Wed, 28 Nov 2001, Daniel Jacobowitz wrote:
> On Wed, Nov 28, 2001 at 09:31:07AM +0000, Jason Merrill wrote:
> > >>>>> "Daniel" == Daniel Jacobowitz <drow@mvista.com> writes:
> >
> > > I'll not be posting the patches for another day or two. The way I do it now
> > > is grossly inefficient; I look through RTTI at every lookup instead of once
> > > per type. It also depends on presence of RTTI. There's not much I can do
> > > about that - or rather, I could, but AFAICT it would require walking the
> > > inheritance graph in the proper order and I don't have the machinery to do
> > > that easily. I'm not heartbroken that we need RTTI for debugging though.
> >
> > So you're using the inheritance information in the RTTI rather than the debug
> > info? That seems unfortunate. I'm not sure why you would need to worry
> > about ordering; the debug info should tell you exactly where things are.
> > If it doesn't, it should probably be fixed.
>
> In that case, the debug info absolutely needs to be fixed.
>
> (I'm looking at stabs here. I haven't tried to see what Dwarf2 emits
> yet. I don't have my head wrapped around Dwarf2. Yeah, I know, I
> should be using it.)
>
> Consider this:
>
> struct Base { int xxx; };
> struct Left : public virtual Base { int yyy; };
> struct Right : public virtual Base { int zzz; };
> struct Bottom : public Left, public Right { int bbb; };
>
> int main() { struct Bottom bzz; return 1; }
>
> The question, of course, is: Where's bzz.xxx?
>
> Dwarf2 first:
> <1><115>: Abbrev Number: 15 (DW_TAG_structure_type)
> DW_AT_sibling : <1c2>
> DW_AT_name : Bottom
> DW_AT_byte_size : 24
> DW_AT_decl_file : 1
> DW_AT_decl_line : 4
> DW_AT_containing_type: <22e>
> <2><128>: Abbrev Number: 16 (DW_TAG_inheritance)
> DW_AT_type : <22e>
> DW_AT_data_member_location: 2 byte block: 23 0 (DW_OP_plus_uconst: 0; )
> DW_AT_accessibility: 1 (public)
> <2><131>: Abbrev Number: 16 (DW_TAG_inheritance)
> DW_AT_type : <2df>
> DW_AT_data_member_location: 2 byte block: 23 8 (DW_OP_plus_uconst: 8; )
> DW_AT_accessibility: 1 (public)
> <2><13a>: Abbrev Number: 3 (DW_TAG_member)
> DW_AT_name : bbb
> DW_AT_decl_file : 1
> DW_AT_decl_line : 4
> DW_AT_type : <cd>
> DW_AT_data_member_location: 2 byte block: 23 10 (DW_OP_plus_uconst: 16; )
>
> Do you see it? I don't, and I'm pretty sure it's not there.
Umm, look at type 2df and 22e.
I'm going to bet money xxx is there.