1 DEMANGLE(1)                      User Commands                     DEMANGLE(1)
   2 
   3 NAME
   4      demangle - demangle symbols
   5 
   6 SYNOPSIS
   7      demangle [-l lang] [symbol...]
   8 
   9 DESCRIPTION
  10      The demangle utility attempts to detect mangled symbols and transform
  11      them back into a more human friendly version of the symbol.
  12 
  13      Some languages allow the same identifier to refer to multiple things
  14      (functions, variables, etc.) where some additional context such as
  15      parameter types, return types, etc. are used to disambiguate between the
  16      symbols sharing the same name.  When compiling such languages into an
  17      executable form, most binary formats do not allow for duplicate symbol
  18      names or provide a way to disambiguate between duplicate names.
  19 
  20      To solve this problem, many languages will use the additional context
  21      from the source code to transform the symbol name into a unique name.
  22      This process is called name mangling.  While the resulting name is
  23      predictable, the mangled names are often difficult for humans to
  24      interpret.
  25 
  26      The demangle utility can be invoked in one of two ways.  In the first
  27      method, symbol is demangled and the result is written to standard out,
  28      one line per input symbol.  If any input symbol cannot be demangled, the
  29      original value of symbol is output unchanged.  In the second method,
  30      demangle reads standard in, and whenever it encounters a potential
  31      symbol, it will attempt to replace the symbol in stdandard out with the
  32      demangled version.  If the symbol cannot be demangled, it is output
  33      unchanged.
  34 
  35 OPTIONS
  36      -l lang     Treat all potential symbols as symbols from lang.  By
  37                  default, demangle will attempt to detect the language and
  38                  demangle symbols for all supported languages.  Current
  39                  supported values of lang are:
  40 
  41                        c++   The C++ mangling format defined by the Itanium
  42                              ABI.  While the mangling format was originally
  43                              defined for the Itanium processor, g++ and clang
  44                              use this format for all their supported platforms
  45                              (including x86 and SPARC).
  46 
  47                        rust  The legacy rust mangling format.
  48 
  49                        auto  Attempt to detect the language automatically
  50                              (default).
  51 
  52 EXIT STATUS
  53      The demangle utility exits 0 on success, and >0 if      an error occurs.
  54 
  55 EXAMPLES
  56      Example 1 Demangle symbols given as command line arguments.
  57 
  58      % demangle '_ZGVN9__gnu_cxx16bitmap_allocatorIwE13_S_mem_blocksE'
  59      guard variable for __gnu_cxx::bitmap_allocator<wchar_t>::_S_mem_blocks
  60      %
  61 
  62      Example 2 Demangle symbols from the output of another command.
  63 
  64      % grep slice rust.c | head -1
  65          T("__ZN4core5slice89_$LT$impl$u20$core..iter..traits..IntoIterator$u20$for$u20$$RF$$u27$a$u20$$u5b$T$u5d$$GT$9into_iter17h450e234d27262170E",
  66      % grep slice rust.c | head -1 | demangle
  67          T("core::slice::<impl core::iter::traits::IntoIterator      for &'a     [T]>::into_iter::h450e234d27262170",
  68      %
  69 
  70 INTERFACE STABILITY
  71      The command line options are not stable.  The output is uncommitted.
  72 
  73 illumos                        February 15, 2020                       illumos