This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Demangling C++ global initializers and destructors


On Fri, Feb 28, 2003 at 04:25:18PM +0100, Andreas Schwab wrote:
> Robert Schiele <rschiele at uni-mannheim dot 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 at uni-mannheim dot de

Attachment: pgp00000.pgp
Description: PGP signature


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