Search code examples
c++cfunctionassemblyname-mangling

Function to mangle/demangle functions


I have previously, here, been shown that C++ functions aren't easily represented in assembly. Now I am interested in reading them one way or another because Callgrind, part of Valgrind, show them demangled while in assembly they are shown mangled.

So I would like to either mangle the Valgrind function output or demangle the assembly names of functions. Anyone ever tried something like that? I was looking at a website and found out the following:

Code to implement demangling is part of the GNU Binutils package; 
see libiberty/cplus-dem.c and include/demangle.h.

Has anyone ever tried something like that? I want to demangle/mangle in C.

My compiler is gcc 4.x.


Solution

  • Use the c++filt command line tool to demangle the name.