The GNU 4.1.2 C++ compiler is mangling typedef names to the point that they are 
not retrievable from the DWARF data.

For example, the type BASE_UNION is defined as

typedef union
{
   char ch;
   int iVal;
   long IVal;
} BASE_UNION;

The GNU 4.1.2 compiler generates the following DWARF data for this type

<1><1279>: Abbrev Number: 35 (DW_TAG_union_type)
  <127a>     DW_AT_sibling     : <12a8> 
  <127e>     DW_AT_name        : $_4    
  <1282>     DW_AT_byte_size   : 4      
  <1283>     DW_AT_decl_file   : 35     
  <1284>     DW_AT_decl_line   : 29     
 <2><1285>: Abbrev Number: 36 (DW_TAG_member)
  <1286>     DW_AT_name        : ch     
  <1289>     DW_AT_decl_file   : 35     
  <128a>     DW_AT_decl_line   : 30     
  <128b>     DW_AT_type        : <c0d>  
 <2><128f>: Abbrev Number: 36 (DW_TAG_member)
  <1290>     DW_AT_name        : iVal   
  <1295>     DW_AT_decl_file   : 35     
  <1296>     DW_AT_decl_line   : 31     
  <1297>     DW_AT_type        : <b7f>  
 <2><129b>: Abbrev Number: 36 (DW_TAG_member)
  <129c>     DW_AT_name        : IVal   
  <12a1>     DW_AT_decl_file   : 35     
  <12a2>     DW_AT_decl_line   : 32     
  <12a3>     DW_AT_type        : <b86>  

Notice that the union name has been changed to "$_4" in DIE <1279>.

The GNU 3.4.4 compiler generates the following DWARF data from the same source 
code:

 <1><11d0>: Abbrev Number: 27 (DW_TAG_union_type)
     DW_AT_sibling     : <123f> 
     DW_AT_name        : (indirect string, offset: 0x6e): BASE_UNION    
     DW_AT_byte_size   : 4      
     DW_AT_decl_file   : 3      
     DW_AT_decl_line   : 29     
 <2><11dc>: Abbrev Number: 28 (DW_TAG_member)
     DW_AT_name        : ch     
     DW_AT_decl_file   : 3      
     DW_AT_decl_line   : 30     
     DW_AT_type        : <e6d>  
 <2><11e6>: Abbrev Number: 28 (DW_TAG_member)
     DW_AT_name        : iVal   
     DW_AT_decl_file   : 3      
     DW_AT_decl_line   : 31     
     DW_AT_type        : <ddf>  
 <2><11f2>: Abbrev Number: 28 (DW_TAG_member)
     DW_AT_name        : IVal   
     DW_AT_decl_file   : 3      
     DW_AT_decl_line   : 32     
     DW_AT_type        : <de6>  
 <2><11fe>: Abbrev Number: 29 (DW_TAG_subprogram)
     DW_AT_sibling     : <1219> 
     DW_AT_name        : (indirect string, offset: 0x79): operator=     
     DW_AT_type        : <123f> 
     DW_AT_artificial  : 1      
     DW_AT_declaration : 1      
 <3><120d>: Abbrev Number: 9 (DW_TAG_formal_parameter)
     DW_AT_type        : <1245> 
     DW_AT_artificial  : 1      
 <3><1213>: Abbrev Number: 10 (DW_TAG_formal_parameter)
     DW_AT_type        : <124b> 
 <2><1219>: Abbrev Number: 30 (DW_TAG_subprogram)
     DW_AT_sibling     : <1230> 
     DW_AT_name        : $_4    
     DW_AT_artificial  : 1      
     DW_AT_declaration : 1      
 <3><1224>: Abbrev Number: 9 (DW_TAG_formal_parameter)
     DW_AT_type        : <1245> 
     DW_AT_artificial  : 1      
 <3><122a>: Abbrev Number: 10 (DW_TAG_formal_parameter)
     DW_AT_type        : <124b> 
 <2><1230>: Abbrev Number: 31 (DW_TAG_subprogram)
     DW_AT_name        : $_4    
     DW_AT_artificial  : 1      
     DW_AT_declaration : 1      
 <3><1237>: Abbrev Number: 9 (DW_TAG_formal_parameter)
     DW_AT_type        : <1245> 
     DW_AT_artificial  : 1      


Notice that DIE <11D0> contains the correct type name.  Also notice that 
coincidently, DIE <1230> has a constructor with the "$_4" name which was used 
as the type name in GNU 4.1.2.  

Why is GNU 4.1.2 generating the mangled type name and how do I correct this to 
generate the real type name?




      

Reply via email to