This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

dwarf 2 debug information and name mangling


In order to find which segment a variable's address is defined 
in relation to, I need to do a mapping from the variable name, 
(as found in source code), to the gcc mangled variable's name, 
(as found in the result from objdump).

To examplify:

The variable's name is wl_fov. It is a static array defined 
inside a class member function. 

It's  dwarf2 debug information entry is as follows, :
(gcc version 2.95.2 19991024 (release))

<3>< 2131>	DW_TAG_variable
                DW_AT_name             wl_fov
                DW_AT_decl_file        4
                DW_AT_decl_line        53
                DW_AT_type             <2179>
                DW_AT_location         DW_OP_addr 0xe0


There is no information about which segment it's address is 
offset from. By using elf libraries I am able to find the segment 
a variable's address is offset from. This requires that the name 
of the variable as it appears in the object file is known. It 
seems that gcc does some kind of mangling on some variables, 
making wl_fov appear like this in the output from objdump with 
the -x option:

000000e0 l     O .bss   00000180 wl_fov.16

.16 is added at the end of the variables name. 

I need to find a way to map from unmangled names to mangled names, 
so that I can find the right entry in the symbol table. 

Does there exist such a mapping?

or

Is there a patch for gcc that makes it add a DW_AT_MIPS_linkage_name 
attribute to variable entries like these?

Thank you.

Torleif Sandnes


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]