Decoding munged function names

Hi folks,

I'm currently extending my model checker to collect coverage information, and as part of this I'm finding a need to get a more friendly version of munged C++ identifiers than the name used by the linker. For example, though internally, something like '_Z7thread1Pv' is fine as an identifier, I'd like to be able to give the user something more readable. Since the disassembler seems to be able to do this, I'd like to be able to do it too, though I can't spot anything in the Function class interface that looks like a candidate. My code needs to live inside an opt pass, effectively within one of my code annotation passes.

Thank you in advance,
Sarah Thompson

PS: I've been quiet for a while, but I'm still at NASA Ames, plugging away at my LLVM-based model checker.

Hi Sarah,

libstdc++ and other Itanium C++ ABI conformant libraries provide a demangler:
http://www.codesourcery.com/public/cxx-abi/abi.html#demangler

-Chris

Hi folks,

I'm currently extending my model checker to collect coverage
information, and as part of this I'm finding a need to get a more
friendly version of munged C++ identifiers than the name used by the
linker. For example, though internally, something like '_Z7thread1Pv'
is fine as an identifier, I'd like to be able to give the user
something more readable. Since the disassembler seems to be able to do
this, I'd like to be able to do it too, though I can't spot anything
in the Function class interface that looks like a candidate. My code
needs to live inside an opt pass, effectively within one of my code
annotation passes.

Can you just run c++filt?

c++filt _Z7thread1Pv
thread1(void*)

Thank you in advance,
Sarah Thompson

PS: I've been quiet for a while, but I'm still at NASA Ames, plugging
away at my LLVM-based model checker.

Cheers,