Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: "David Plumb" <David.Plumb@intellon.com>
Cc: <gdb@sourceware.org>
Subject: Re: incorrect address of class member
Date: Wed, 12 Aug 2009 14:23:00 -0000	[thread overview]
Message-ID: <m3eirhru14.fsf@fleche.redhat.com> (raw)
In-Reply-To: <5630E8542965844685CBA4EB1C4785048EA900@cdnpostal.Intellon.com> (David Plumb's message of "Wed\, 12 Aug 2009 09\:35\:38 -0400")

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


  parent reply	other threads:[~2009-08-12 14:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-12 13:35 David Plumb
2009-08-12 13:47 ` Daniel Jacobowitz
2009-08-12 14:23 ` Tom Tromey [this message]
2009-08-12 19:19   ` Tom Tromey
2009-08-12 19:26     ` David Plumb

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3eirhru14.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=David.Plumb@intellon.com \
    --cc=gdb@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox