13.2. tiarmdem - C++ Name Demangler Utility

The tiarmdem 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.

13.2.1. Usage

tiarmdem [options] [mangled names]

  • options - affect how the tiarmdem 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 tiarmdem utility, then tiarmdem will read 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 tiarmdem utility is to pipe the output of the tiarmnm name utility to a tiarmdem command invocation.

13.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 tiarmdem executable.

@<file>

Read command-line options from specified <file>.

13.2.3. Examples

  • Specifying mangled names on command-line:

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

    %> tiarmdem _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 tiarmdem as follows:

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

    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:

    tiarmclang -mcpu=cortex-m4 -c test.cpp
    

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

    %> tiarmnm 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 tiarmnm to tiarmdem to demangle the mangled names that are present in the tiarmnm output:

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

13.2.4. Exit Status

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