Demangling C++ global initializers and destructors

Robert Schiele rschiele@uni-mannheim.de
Fri Feb 28 18:33:00 GMT 2003


On Fri, Feb 28, 2003 at 04:25:18PM +0100, Andreas Schwab wrote:
> Robert Schiele <rschiele@uni-mannheim.de> writes:
> 
> |> Hello.
> |> 
> |> Currently the -C option on the binutils tools does not demangle global
> |> C++ initializers and destructors, because the demangler is confused by
> |> the _GLOBAL__?_ prefix.  The following patch changes this by skipping
> |> this prefix when handing down to the demangler.  This means for
> |> example _GLOBAL__I__ZN10HashBasics13hashtablesizeEj is demangled to
> |> _GLOBAL__I_HashBasics::hashtablesize(unsigned).
> |> 
> |> What do you think about such a change?
> 
> I think this should rather be fixed in the demangler, so that it properly
> detects ctor/dtor symbols.

Hmm, I see.

But the comment for cplus_demangle() says:

  Note that any leading underscores, or other such characters
  prepended by the compilation system, are presumed to have already
  been stripped from MANGLED.

So, you consider this prefix beeing part of the mangled name?

But the C++ ABI says, that all mangled names begin with "_Z".

So there are two questions:

1. On which level of the call hierarchy when demangling such symbols
   in libiberty would you place this conversion?

2. How should the demangled representation look like?
   "_GLOBAL__I_HashBasics::hashtablesize(unsigned)" or some more
   readable format?

I am interrested in this stuff, as I am currently developing an open
source tool to analyze dynamic behaviour of applications.  The tool
shows the actual call tree of a application.  As big C++ applications
often have a mass of global initializers on the top level of the call
hierarchy, it makes the output of the tool much more readable when
these names are demangled.

Robert

-- 
Robert Schiele			Tel.: +49-621-181-2517
Dipl.-Wirtsch.informatiker	mailto:rschiele@uni-mannheim.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 481 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20030228/5cae2d52/attachment.sig>


More information about the Binutils mailing list