0

Gcc compilers build c++filt during installation. So all the source is "somewhere" available to use it from own progs.

What I want to achieve:

I read some elf files and get also the symbols, no problem. For c++ generated elf files, I see the mangled names as expected. Now I want to make my program output a bit more convenient and include c++filt functionality into my program. It makes no sense to parse my really huge output throw the external c++filt program.

Has someone an idea where to catch the source files of the demangler from the gcc sources or is there already some shared object or static library which I can pick?

In my case I need it for avr-gcc if the target makes c++filt specific.

Klaus
  • 24,205
  • 7
  • 58
  • 113
  • but.. is `nm -C` not enough? – KamilCuk Oct 01 '20 at 18:55
  • Although the accepted answer in the linked dupe points to c++filt (of which you're obviously already aware) the other two show how to do this without invoking it. I don't see build directions there--you need to link with `libiberty`. Although I don't like its code as well, the gcc docs show how to do it as well: https://gcc.gnu.org/onlinedocs/libstdc++/manual/ext_demangling.html – Jerry Coffin Oct 01 '20 at 19:13
  • @KamilCuk: I don't want to use an external program. I simply want to call something like Demangle(symbol) inside my prog. – Klaus Oct 01 '20 at 19:13

0 Answers0