GithubHelp home page GithubHelp logo

demangle's Introduction

Demangle

This is a tool to help you demangle C++ symbols. These are symbols that you might see while looking at GDB backtraces, or perhaps as a result of looking at the symbol table from nm, objdump, etc.

Usage

Example usage:

$ demangle _ZNSt8ios_base15sync_with_stdioEb _ZNKSt5ctypeIcE13_M_widen_initEv
std::ios_base::sync_with_stdio(bool)  _ZNSt8ios_base15sync_with_stdioEb
std::ctype<char>::_M_widen_init() const  _ZNKSt5ctypeIcE13_M_widen_initEv

By default the mangled symbol will be printed after the demangled symbol. If you don't want this behavior you can use the -q or --quiet options:

$ demangle -q _ZNSt8ios_base15sync_with_stdioEb _ZNKSt5ctypeIcE13_M_widen_initEv
std::ios_base::sync_with_stdio(bool)
std::ctype<char>::_M_widen_init() const

You can also get help using demangle -h or demangle --help.

Compiling

You'll need autotools, make, and a C++ compiler. Then you should be able to do:

./autogen.sh
./configure
make
make install

If you don't want to run the make install step you can directly use the binary that will be built at src/demangle.

Note: the C++ compiler you use affects which symbols you can demangle. In particular, if you want to demangle GCC symbols you need to compile this with GCC. Likewise, if you want to demangle Clang symbols you need to compile this with Clang. I have intentionally avoided the use of any C++ standard library methods to make this easy to compile on Linux to demangle OS X symbols, and likewise to make it easy to compile on OS X to demangle Linux sysmbols.

You can figure out what "personality" the demangler was compiled with using the -p or --personality option.

Clang on Linux

If you're on a Linux system like Debian, Ubuntu, Fedora, or likely any other distribution that normally uses GCC and you want to build this with Clang to demangle Clang symbols you can compile it like this:

CXX=clang++ ./configure
make

Then you should see:

$ demangle -p
Personality: Clang/LLVM

GCC on OS X

The same applies for OS X, which normally uses Clang. If you want to demangle GCC symbols you can compile like this:

CXX=g++ ./configure
make

Then you should see:

$ demangle -p
Personality: GNU GCC/G++

demangle's People

Contributors

eklitzke avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

demangle's Issues

Names from nm tool have extra underscore

Hi there. Thanks for this tool.

Names from nm have an extra underscore in the beginning. I was hoping you could enhance your tool to accept an optional leading underscore.

$ demangle __ZN7cvflann7anyimpl14big_any_policyINS_20flann_centers_init_tEE13static_deleteEPPv
FAIL: __ZN7cvflann7anyimpl14big_any_policyINS_20flann_centers_init_tEE13static_deleteEPPv is not a valid name under the C++ ABI mangling rules
$ demangle ZN7cvflann7anyimpl14big_any_policyINS_20flann_centers_init_tEE13static_deleteEPPv
FAIL: ZN7cvflann7anyimpl14big_any_policyINS_20flann_centers_init_tEE13static_deleteEPPv is not a valid name under the C++ ABI mangling rules
$ demangle _ZN7cvflann7anyimpl14big_any_policyINS_20flann_centers_init_tEE13static_deleteEPPv
cvflann::anyimpl::big_any_policy<cvflann::flann_centers_init_t>::static_delete(void**)  _ZN7cvflann7anyimpl14big_any_policyINS_20flann_centers_init_tEE13static_deleteEPPv

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.