pr9065 patch (the typeid thing)

Chris Moller cmoller@redhat.com
Mon Mar 22 12:19:00 GMT 2010


On 03/11/10 16:32, Tom Tromey wrote:
>
> Chris>  Another difference is that the real typeid returns mangled names,
> Chris>  leaving it to the user to demangle.  This strikes me as a pain, so I
> Chris>  just provide the demangled names.
>
> It should be compatible.  GDB has a demangle command for this purpose.
>
>    

I've done a lot of re-write on this patch over the last week or so, but 
the requirement for returning mangled names turns out to be a bit of a 
stopper:  mangled names for built-in types don't exist at all in gdb, 
and mangled names for symbols are only occasionally available.

My first thought was to clone the gcc mangler; my second thought was 
that's not really the best solution.  I don't know if it's intended for 
gdb to be able to debug stuff compiled by anything other than gcc, but 
since every compiler uses its own mangling algo, forcing the use of the 
gcc mangling algo certainly wouldn't be compatible with that.  Also, 
though I don't know how likely it is, it's not impossible that the gcc 
algo could change.

At least one of the probable reasons mangled symbol names aren't 
available seems to be that they're not emitted in the DWARF.  In my 
testcase, of the dozen or so vars and fcns I use, the mangled name of 
only one of them appears in the DWARF (tagged with 
DW_AT_MIPS_linkage_name--why just that one symbol and nothing else, I 
haven't a clue), so my guess is that if gcc could somehow be convinced 
to emit the mangled names of all symbols and primitive types, things 
would be cool, but I don't know how hard it would be to get gcc (i.e., 
its maintainers) to do that..  (I couldn't find a gcc option that made 
that happen...)

Chris



More information about the Gdb-patches mailing list