This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: incorrect address of class member


>>>>> "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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]