From: David Carlton <carlton@math.stanford.edu>
To: Jim Blandy <jimb@zenia.red-bean.com>
Cc: gdb <gdb@sources.redhat.com>
Subject: Re: DWARF-2, static data members
Date: Tue, 13 Aug 2002 14:05:00 -0000 [thread overview]
Message-ID: <ro165yejwpf.fsf@jackfruit.Stanford.EDU> (raw)
In-Reply-To: <vt2ofc6ze70.fsf@zenia.red-bean.com>
In article <vt2ofc6ze70.fsf@zenia.red-bean.com>, Jim Blandy
<jimb@zenia.red-bean.com> writes:
> I agree with your reading. There should be *two* entries for a C++
> static data member: one as a variable definition, DW_TAG_variable,
> at the top level, and one as a member definition, DW_TAG_member, as
> a child of the struct/class/union die.
Right. Though you can presumably skip the DW_TAG_variable entry if
you're compiling a file in which that variable never gets defined or
referred to. (E.g. if the file you're compiling includes a header
file defining a class that it uses, but the file you're compiling
doesn't happen to use that particular static member of the class
itself.)
> For what it's worth, the paragraph of the Dwarf 2 spec that
> corresponds to paragraph 6. in Section 4.1 of Draft 3 rev 7 (what I
> treat as authoritative for Dwarf 3) doesn't specify what tag the
> type die's child is supposed to have.
Good point: I'd missed that Dwarf 3 is more explicit there. Dwarf 2
seems to me to be explicit enough, in that the section on class
declarations that says that data members should have the DW_TAG_member
(with no exception for static data members), but it's a good thing
that Dwarf 3 makes that clearer.
> Have you run `readelf -wi' on the executable, or run GCC with
> `-save-temps -dA' and looked at the .s file, to see what GCC is
> actually generating? I think GCC does generate children of
> struct/class types with the DW_TAG_variable tag.
I'll have to look up what those arguments mean :-), but I did do g++
-S yesterday and went through the .s file by hand. (Fun, and
educational, though I don't plan to do it too often.) It really is
generating DW_TAG_variable tags instead of DW_TAG_member tags.
> You might put together a fix for GCC, too --- dwarf2out.c is big,
> but it doesn't seem too bad. This would allow you to actually test
> your changes.
I'll give it a look. I did submit a PR for GCC, so at least it's in
their bug database.
David Carlton
carlton@math.stanford.edu
next prev parent reply other threads:[~2002-08-13 21:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-08-09 15:10 David Carlton
2002-08-13 13:48 ` Jim Blandy
2002-08-13 14:05 ` David Carlton [this message]
2002-08-13 15:29 ` Jim Blandy
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=ro165yejwpf.fsf@jackfruit.Stanford.EDU \
--to=carlton@math.stanford.edu \
--cc=gdb@sources.redhat.com \
--cc=jimb@zenia.red-bean.com \
/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