This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: incorrect address of class member
- From: Tom Tromey <tromey at redhat dot com>
- To: "David Plumb" <David dot Plumb at intellon dot com>
- Cc: <gdb at sourceware dot org>
- Date: Wed, 12 Aug 2009 08:22:47 -0600
- Subject: Re: incorrect address of class member
- References: <5630E8542965844685CBA4EB1C4785048EA900@cdnpostal.Intellon.com>
- Reply-to: tromey at redhat dot com
>>>>> "David" == David Plumb <David.Plumb@intellon.com> writes:
David> I'm sorry if this is the wrong mailing list. I am having a problem with
David> gdb but I don't know if it falls into the category of a bug report yet.
No problem :)
David> If gdb is using the wrong address for the mFlag member, it explains why
David> the gdb print command is returning the wrong value for the mFlag member.
For this sort of thing, I think you can't tell if it is a gcc bug or a
gdb bug without digging below the surface. I compiled your program with
a somewhat newer gcc (I don't have 3.4 around any more), and I was still
able to reproduce it.
I think it is a gcc bug, because readelf shows:
<2><8e>: Abbrev Number: 7 (DW_TAG_member)
<8f> DW_AT_name : (indirect string, offset: 0xc8): mHugeArray
<93> DW_AT_decl_file : 1
<94> DW_AT_decl_line : 13
<95> DW_AT_type : <0xf2>
<99> DW_AT_data_member_location: 2 byte block: 23 0 (DW_OP_plus_uconst: 0)
<9c> DW_AT_accessibility: 3 (private)
<2><9d>: Abbrev Number: 7 (DW_TAG_member)
<9e> DW_AT_name : (indirect string, offset: 0x0): mFlag
<a2> DW_AT_decl_file : 1
<a3> DW_AT_decl_line : 14
<a4> DW_AT_type : <0x53>
<a8> DW_AT_data_member_location: 2 byte block: 23 0 (DW_OP_plus_uconst: 0)
<ab> DW_AT_accessibility: 3 (private)
... which, if I am reading this correctly, puts both mHugeArray and
mFlag at offset 0 -- see those DW_AT_data_member_location attributes.
Tom