[Dwarf-Discuss] Mangled Type Def info in GNU 4.x DWARF data?

John DelSignore jdelsign@totalviewtech.com
Thu Jan 21 16:00:29 GMT 2010


Ron Louzon wrote:
> We have just migrated from the GNU 3.x compiler to GNU 4.x and this has
> introduced problems with type defs in the DWARF data.

A small source code fragment along with a DWARF symbol table dump (readelf, dwarfdump, etc) of the object file (the .o) would be really helpful.

Also, the precise version of GCC 4.x would be helpful too. A lot has change in the debug information produced by GCC 4.4 vs GCC 4.3 on Red Hat (and maybe elsewhere).

> I have a static variable ?MyVariable? which is of type ?MyType_T? and
> that type is a type def.

What is the target type of MyType_T? Is it a typedef to a nameless structure? For example:

typedef struct {
  int member;
} MyType_t;

Or something else?

> When I look at the DWARF data, the DIE for ?MyVariable? contains the
> DW_AT_type attribute which points to the type information.
>  
> The DIE for the type information contains the DW_AT_name attribute with
> a value of ?$_271? but all of the type information under this DIE is
> correct.

I've seen compilers elide the typedef information, though without the source code and DWARF symbol table dump I can't say for sure that this is what your GCC 4.x is doing.

Cheers, John D.


> I did a search on the DWARF dump and the ?MyType_T? type def does not
> appear anywhere in the output except for one place which is very
> strange.  ?MyType_T? appears as the name attribute value in a
> ?DW_TAG_subprogram? DIE as
>  
> <2><605AFA> Abbrev Number: 75  (DW_TAG_subprogram)
> DW_AT_external: 1
> DW_AT_name: (indirect string, offset:0x7701F ): MyType_T
> DW_AT_artificial: 1
> DW_AT_declaration: 1
>  
> <3><605B02> Abbrev Number: 19 (DW_TAG_formal_parameter)
> DW_AT_type: <607792>
> DW_AT_artificial: 1
>  
> The source code does not contain any subprograms, functions or methods
> which are named ?MyType_T? and yet ?MyType_T? appears in the DWARF data
> as a subprogram definition.  Why is the type mangled into ?$_271??  This
> presents a problem for me when I need to retrieve information for the
> type ?MyType_T?.  Has anyone encountered this problem and if so, how did
> you retrieve the type information.
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Dwarf-Discuss mailing list
> Dwarf-Discuss at lists.dwarfstd.org
> http://lists.dwarfstd.org/listinfo.cgi/dwarf-discuss-dwarfstd.org




More information about the Dwarf-discuss mailing list