A C++ name demangling command-line utility.
Only works for mangled symbols that follow the Itanium C++ ABI, like Clang and GCC.
Symbols to be demangled can be given to stdin
or as command line arguments.
Default output follows the format mangled\tdemangled
:
3fooIJiEE foo<int>
Symbol passed to stdin
.
$ echo 'N3foo3barIJidEEE' | demangle
N3foo3barIJidEEE foo::bar<int, double>
Symbol passed as command line argument:
$ demangle N3foo3barIJidEEE
N3foo3barIJidEEE foo::bar<int, double>
Multiple symbols passed to stdin
:
$ echo 'i N3foo3barIJidEEE' | demangle
i int
N3foo3barIJidEEE foo::bar<int, double>
Multiple symbols passed as command line arguments:
$ demangle i N3foo3barIJidEEE
i int
N3foo3barIJidEEE foo::bar<int, double>
Filtering error messages when demangling symbols mixed with other text:
$ echo 'i N3foo3barIJidEEE this_is_not_a_valid_symbol' | demangle 2> /dev/null
i int
N3foo3barIJidEEE foo::bar<int, double>
GCC or Clang compiler, any version compatible with C++11.
Provided you have cmake
installed, run ./build.sh install_directory
.
./build.sh /usr/local
Replace $INSTALL_DIRECTORY
below with the install directory of your choice.
cmake -DCMAKE_INSTALL_PREFIX=$INSTALL_DIRECTORY
make install
mkdir out && cd out
cmake ..
make
Assuming $OUT_DIR
is the destination directory for the binary:
g++ -Wall -std=c++11 -O3 src/demangle.cpp -o $OUT_DIR/demangle
or
clang++ -Wall -std=c++11 -O3 src/demangle.cpp -o $OUT_DIR/demangle