11.2. c29dem - C++ Name Demangler Utility

The c29dem utility can read a series of C++ mangled symbol names and print their demangled form to stdout. If a name cannot be demangled, it is simply printed as is.

11.2.1. Usage

c29dem [options] [mangled names]

  • options - affect how the c29dem utility behaves in processing any specified mangled names.

  • mangled names - a list of one or more symbol names that are presumed to be potentially C++ symbol names. If no mangled names are specified as input to the c29dem utility, then c29dem reads any input symbol names from stdin. When reading symbol names from standard input, each input line is split on characters that are not part of valid Itanium name manglings, i.e. characters that are not alphanumeric, ‘.’, ‘$’, or ‘_’. Separators between names are copied to the output as is. A common use case for feeding symbol names as input to the c29dem utility is to pipe the output of the c29nm name utility to a c29dem command invocation.

11.2.2. Options

--format=<scheme>, -S=<scheme>

Select a mangled <scheme> to assume. Supported values for the <scheme> argument include:

  • auto (default)

  • gnu

--help, -h

Print a summary of the command-line options and their meanings.

--help-list

Print an uncategorized summary of command-line options and their meanings.

--no-strip-underscore, -n

Do not strip leading underscore. This option is enabled by default.

--strip-underscore, -_

Strip a leading underscore, if present, from each input symbol name before demangling.

--types, -t

Attempt to demangle symbol names as type names as well as function names.

--version

Display the version of the c29dem executable.

@<file>

Read command-line options from specified <file>.

11.2.3. Examples

  • Specifying mangled names on the command line:

    Symbol names can be specified as input to the c29dem C++ name demangler utility on the command line as in the following:

    %> c29dem _Z3foov _Z3bari not_mangled
    foo()
    bar(int)
    not_mangled
    
  • Specifying mangled names in a text file:

    Symbol names can be specified on separate lines in a text file:

    %> cat sym_names.txt
    _Z3foov
    _Z3bari
    not_mangled
    

    The text file can then be specified as input to c29dem as follows:

    %> c29dem < sym_names.txt
    foo()
    bar(int)
    not_mangled
    
  • Piping output of c29nm as input to c29dem:

    Consider the following source file (test.cpp):

    int g_my_num;
    namespace NS { int ns_my_num = 2; }
    int f() { return g_my_num + NS::ns_my_num; }
    int main() { return f(); }
    

    If the above test.cpp is compiled:

    c29lang -mcpu=c29.c0 -c test.cpp
    

    We can then use the c29nm utility to write out the symbol names in test.o:

    %> c29nm test.o
    00000000 T _Z1fv
    00000000 D _ZN2NS9ns_my_numE
    00000000 B g_my_num
    00000000 T main
    

    and we could pass the output of c29nm to c29dem to demangle the mangled names that are present in the c29nm output:

    %> c29nm test.o | c29dem
    00000000 T f()
    00000000 D NS::ns_my_num
    00000000 B g_my_num
    00000000 T main
    

11.2.4. Exit Status

The c29dem utility returns 0 unless it encounters a user error, in which case a non-zero exit code is returned.