Demangling C++ global initializers and destructors

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


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?

Or do you prefer a different style for the demangled version of these
symbols?

2003-02-28  Robert Schiele  <rschiele@uni-mannheim.de>

	* binutils/budemang.c (demangle): Allow demangling of
          _GLOBAL__?_ symbols.

Index: binutils/budemang.c
===================================================================
RCS file: /cvs/src/src/binutils/budemang.c,v
retrieving revision 1.3
diff -u -r1.3 budemang.c
--- binutils/budemang.c	23 Jul 2002 05:12:26 -0000	1.3
+++ binutils/budemang.c	28 Feb 2003 14:31:55 -0000
@@ -54,6 +54,11 @@
   while (*p == '.')
     ++p;
 
+  /* This allows demangling of static initializers and
+     destructors.  */
+  if (! (strncmp(p, "_GLOBAL__I_", 11) && strncmp(p, "_GLOBAL__D_", 11)))
+    p += 11;
+
   res = cplus_demangle (p, DMGL_ANSI | DMGL_PARAMS);
   if (res)
     {

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/fac17bec/attachment.sig>


More information about the Binutils mailing list