Name Mangling from Solaris CC

Guenther Grau Guenther.Grau@bk.bosch.de
Thu May 7 10:24:00 GMT 1998


Hi,

Jason Molenda wrote:
> 
> On Mon, May 04, 1998 at 05:44:18PM -0400, Jake Colman wrote:
> >
> > Does gdb 4.17 debug output from Solaris 2.4 CC compiler?  I tried using it and
> > it appears that gdb does not demangle that compiler's function names.  Is this
> > true? I would have thought that 4.17 would have added that support.
> 
> I don't know of any support for the Solaris C++ compiler's name mangling
> in GDB.  I don't know of anybody currently working on this support.
> GDB does have support for different name mangling styles (there is code
> in GDB for the g++ , Lucid, and ARM styles).
> 
> If you would like to add support for the Solaris C++ name mangling,
> and can do so from publically available documentation from Sun or by
> examination of the compiler's output, I would be interested in adding
> this support.  Talk to me directly if you're in a position to do this
> and are interested.

Hmm, is this really such a big deal of adding it? gdb correctly outputs
the non demangled C++ names on Solaris. Cut&Paste from gdb output to
dem(1) on Solaris yields the proper demangled name. How about just
adding a call to 

cplus_demangle(const char *in, char *out, size_t size);

in the Solaris case and invoke this with a new option to the demangling
style?

gorgo% uname -a
SunOS gorgo.bk.bosch.de 5.5.1 Generic_103640-12 sun4u sparc SUNW,Ultra-1
gorgo% man demangle
DEMANGLE(3)       MISC. REFERENCE MANUAL PAGES        DEMANGLE(3)
 
 
 
NAME
     demangle - decode a C++ encoded symbol name
 
SYNOPSIS
     CC [ flag ... ] file ... [ library ...]
     #include <demangle.h>
     cplus_demangle(const char *in, char *out, size_t size);
 
DESCRIPTION
     cplus_demangle() decodes  the  string  in,  and  copies  the
     result  to  out.   in points to a string representing a name
     mangled by the C++ compiler. out is a buffer of size  bytes,
     that  you specify. If the output buffer is too small to con-
     tain   the   demangled   name,   cplus_demangle()    returns
     DEMANGLE_ESPACE,  and  the  contents  of  out are undefined.
     Otherwise,  if  the  name  is  a  valid  C++  mangled  name,
     cplus_demangle()  returns  0.  If in is not a valid C++ man-
     gled name, it is copied unchanged to out, and  the  function
     returns DEMANGLE_ENAME.
 
     cplus_demangle() operates on mangled names generated by  C++
     3.0.1 and all versions of C++ 4.0 and above.
 
SEE ALSO
     CC(1)

  Guenther



More information about the Gdb mailing list