------- Comment #7 from jakub at gcc dot gnu dot org  2008-08-18 08:11 -------
To expand on the duplicate DIE issue in C++, say:
namespace N
{
  int i;
}
int foo ()
{
  using N::i;
  return i;
}
emits:
        .uleb128 0x3    # (DIE (0x55) DW_TAG_imported_declaration)
        .byte   0x1     # DW_AT_decl_file (mno2.C)
        .byte   0x7     # DW_AT_decl_line
        .long   0x6d    # DW_AT_import
in foo (correct) and then:
        .uleb128 0x5    # (DIE (0x64) DW_TAG_namespace)
        .ascii "N\0"    # DW_AT_name
        .byte   0x1     # DW_AT_decl_file (mno2.C)
        .byte   0x2     # DW_AT_decl_line
        .long   0x8c    # DW_AT_sibling
        .uleb128 0x6    # (DIE (0x6d) DW_TAG_variable)
        .ascii "i\0"    # DW_AT_name
        .byte   0x1     # DW_AT_decl_file (mno2.C)
        .byte   0x3     # DW_AT_decl_line
        .long   .LASF0  # DW_AT_MIPS_linkage_name: "_ZN1N1iE"
        .long   0x5d    # DW_AT_type
        .byte   0x1     # DW_AT_external
        .byte   0x1     # DW_AT_declaration
        .uleb128 0x6    # (DIE (0x7c) DW_TAG_variable)
        .ascii "i\0"    # DW_AT_name
        .byte   0x1     # DW_AT_decl_file (mno2.C)
        .byte   0x3     # DW_AT_decl_line
        .long   .LASF0  # DW_AT_MIPS_linkage_name: "_ZN1N1iE"
        .long   0x5d    # DW_AT_type
        .byte   0x1     # DW_AT_external
        .byte   0x1     # DW_AT_declaration
        .byte   0x0     # end of children of DIE 0x64
        .uleb128 0x7    # (DIE (0x8c) DW_TAG_variable)
        .long   0x7c    # DW_AT_specification
        .byte   0x9     # DW_AT_location
        .byte   0x3     # DW_OP_addr
        .quad   _ZN1N1iE
        .byte   0x0     # end of children of DIE 0xb
Note not just 2, but 3, 2 DW_AT_declaration inside and one DW_AT_specification
DIE outside of the namespace.  If extern int i; is used instead, then the
DW_AT_specification is missing.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu dot
                   |                            |org, drow at gcc dot gnu dot
                   |                            |org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29635

Reply via email to