> Incidentally, I notice that we have unnecessary duplication in the type > units. For instance, with nested-3.C: > > .uleb128 0x2 # (DIE (0x25) DW_TAG_namespace) > .long .LASF0 # DW_AT_name: "thread" > # DW_AT_declaration > .long 0x34 # DW_AT_sibling > .uleb128 0x3 # (DIE (0x2e) DW_TAG_class_type) > .long .LASF1 # DW_AT_name: "Executor" > # DW_AT_declaration > .byte 0 # end of children of DIE 0x25 > .uleb128 0x4 # (DIE (0x34) DW_TAG_class_type) > .long .LASF1 # DW_AT_name: "Executor" > .byte 0x1 # DW_AT_byte_size > .byte 0x1 # DW_AT_decl_file (nested-3.C) > .byte 0x6 # DW_AT_decl_line > .long 0x2e # DW_AT_specification > .long 0x55 # DW_AT_sibling > > This declaration/specification separation seems to be deliberate in > copy_declaration_context, but I don't see any reason for it; what was the > rationale?
I believe I was just replicating the existing practice of putting definitions at the top level, with a DW_AT_specification pointing to a declaration DIE within the namespace/class hierarchy when necessary. I remember there was a comment somewhere in dwarf2out.c that suggested GDB relies on this, but that may be totally out of date, and I can't find it now. -cary