Hide Forgot
gcc generates DW_TAG_Variable tags for static members of classes. Which should be DW_TAG_Member. Dwarf3 spec page 60 point 6: "If the variable entry represents the defining declaration for a C++ static data member of a structure, class or union, the entry has a DW_AT_specification attribute, whose value is a reference to the debugging information entry representing the declaration of this data member. The referenced entry has the tag DW_TAG_member and will be a child of some class, structure or union type entry."
Changing version to '9' as part of upcoming Fedora 9 GA. More information and reason for this action is here: http://fedoraproject.org/wiki/BugZappers/HouseKeeping
So, what exactly needs to change from current gcc output for this? Given say: struct S { int i; static int j; }; int S::j = 72; int main () { S s; s.i++; S::j++; } - .uleb128 0x4 # (DIE (0x43) DW_TAG_variable) + .uleb128 0x4 # (DIE (0x43) DW_TAG_member) .ascii "j\0" # DW_AT_name .byte 0x1 # DW_AT_decl_file (NN.C) .byte 0x4 # DW_AT_decl_line .long .LASF3 # DW_AT_MIPS_linkage_name: "_ZN1S1jE" .long 0x53 # DW_AT_type .byte 0x1 # DW_AT_external .byte 0x1 # DW_AT_declaration (and corresponding: .uleb128 0x4 # (abbrev code) - .uleb128 0x34 # (TAG: DW_TAG_variable) + .uleb128 0xd # (TAG: DW_TAG_member) in .debug_abbrev) is probably not enough, as the standard doesn't list e.g. DW_AT_external to be acceptable for DW_TAG_member. Can DW_AT_MIPS_linkage_name be used on the DW_TAG_member? DW_AT_declaration is allowed, I'm wondering about usual stuff like DW_AT_abstract_origin etc. though.
Hmm.. I cant remember why I cared about this. It seems fine as is. Changing this might actually break gdb lookup and introduce no new functionality. Jan ?.. any thoughts ?
I agree it does not cause any problems to current GDB. FYI dwarf2read.c:dwarf2_add_field(): else if (die->tag == DW_TAG_member || die->tag == DW_TAG_variable) { /* C++ static member. */ /* NOTE: carlton/2002-11-05: It should be a DW_TAG_member that is a declaration, but all versions of G++ as of this writing (so through at least 3.2.1) incorrectly generate DW_TAG_variable tags. */ But even after the GCC change GDB still works for the Jakub's testcase. It is a clear violation of how DWARF specifies this situation according to the Sami's citation. So GCC should change it but it is very low-low priority. (In reply to comment #2) > the standard doesn't list e.g. DW_AT_external to be acceptable for > DW_TAG_member. Appendix A - Other attributes [...] may also appear in a given debugging entry. [...] the list [...] cannot be considered definitive. > Can DW_AT_MIPS_linkage_name be used on the DW_TAG_member? > DW_AT_declaration is allowed, I'm wondering about usual stuff like > DW_AT_abstract_origin etc. though. As all these attributes get inherited to DW_TAG_variable IMO GCC can keep it this way.
That appendix is not normative and there are some sensical attributes for some tags that it does not list. I think it would be correct to s/variable/member/ in the specification DIE. The way I read the spec, everything that is common (including linkage name et al) should go on the member DIE and that is fully kosher with the variable DIE referring to it via specification.
Adding Petr to the CC. Please CC him on any questionable-DWARF sorts of things. We can add this wrinkle to the list to eventually make sure that dwarflint both catches it and recognizes it as a known quirk for gcc < 4.4.
This message is a reminder that Fedora 9 is nearing its end of life. Approximately 30 (thirty) days from now Fedora will stop maintaining and issuing updates for Fedora 9. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as WONTFIX if it remains open with a Fedora 'version' of '9'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version prior to Fedora 9's end of life. Bug Reporter: Thank you for reporting this issue and we are sorry that we may not be able to fix it before Fedora 9 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora please change the 'version' of this bug to the applicable version. If you are unable to change the version, please add a comment here and someone will do it for you. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete. The process we are following is described here: http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Fedora 9 changed to end-of-life (EOL) status on 2009-07-10. Fedora 9 is no longer maintained, which means that it will not receive any further security or bug fix updates. As a result we are closing this bug. If you can reproduce this bug against a currently maintained version of Fedora please feel free to reopen this bug against that version. Thank you for reporting this bug and we are sorry it could not be fixed.