[LLVMbugs] [Bug 11300] New: llvm produces a AT_specification that is a forward reference

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Nov 2 18:21:10 PDT 2011


http://llvm.org/bugs/show_bug.cgi?id=11300

             Bug #: 11300
           Summary: llvm produces a AT_specification that is a forward
                    reference
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: ASSIGNED
          Severity: enhancement
          Priority: P
         Component: Common Code Generator Code
        AssignedTo: rafael.espindola at gmail.com
        ReportedBy: rafael.espindola at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Given

struct foo {
  void bar() {}
};
void zed(foo *x) { x->bar(); }

gcc produces the following dwarf:

-----------------------------------
0x00000071:         TAG_subprogram [3] *
                     AT_external( 0x01 )
                     AT_name( "bar" )
                     AT_decl_file( "/Users/espindola/llvm/test.cc" )
                     AT_decl_line( 2 )
                     AT_MIPS_linkage_name( "_ZN3foo3barEv" )
                     AT_declaration( 0x01 )
....

0x0000008c:     TAG_subprogram [6] *
                 AT_specification( {0x00000071} ( "_ZN3foo3barEv" ) )
                 AT_low_pc( 0x0000000000000370 )
                 AT_high_pc( 0x000000000000037a )
                 AT_frame_base( 0x00000000
                    0x0000000000000370 - 0x0000000000000371: rsp+8
                    0x0000000000000371 - 0x0000000000000374: rsp+16
                    0x0000000000000374 - 0x000000000000037a: rbp+16 )
                 AT_sibling( {0x000000b8} )
---------------------------------

we produce

-------------------------------------
0x00000059:     TAG_subprogram [4] *
                 AT_sibling( {0x00000089} )
                 AT_MIPS_linkage_name( "_ZN3foo3barEv" )
                 AT_specification( {0x00000099} ( "_ZN3foo3barEv" ) )
                 AT_low_pc( 0x0000000000000270 )
                 AT_high_pc( 0x0000000000000276 )
                 AT_frame_base( rsp )
                 AT_APPLE_omit_frame_ptr( 0x01 )
....
0x00000099:         TAG_subprogram [8] *
                     AT_MIPS_linkage_name( "_ZN3foo3barEv" )
                     AT_name( "bar" )
                     AT_decl_file( "/Users/espindola/llvm/test.cc" )
                     AT_decl_line( 2 )
                     AT_prototyped( 0x01 )
                     AT_declaration( 0x01 )
                     AT_external( 0x01 )
                     AT_accessibility( DW_ACCESS_public )
---------------------------------------

Two interesting things to notice:

* AT_MIPS_linkage_name is duplicated.
* AT_specification is a forward reference

The dwarf standard says

-----------------
A debugging information entry that represents a declaration that completes
another (earlier) non- defining declaration may have a DW_AT_specification
attribute whose value is a reference to the debugging information entry
representing the non-defining declaration.
------------------

So I think that the second point actually makes our debug info invalid. In any
case, it breaks breakpad:

http://code.google.com/p/google-breakpad/issues/detail?id=441

The link is being created by

  if (SPDecl.isSubprogram())
    // Refer function declaration directly.
    SPCU->addDIEEntry(SPDie, dwarf::DW_AT_specification, dwarf::DW_FORM_ref4,
                      SPCU->getOrCreateSubprogramDIE(SPDecl));

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list