> 2013/8/17 Slávek Banko <slavek.banko@...> > >> On Friday 16 of August 2013 02:38:43 Fat-Zer wrote: >> > Tim, the code of backtrace_symbols.c is quite complex is it possible >> to >> > make it work without demangle.h? >> >> I saw similar code, where is used bfd_demangle instead of >> cplus_demangle. >> I'm >> not determine if it can be useful. >> >> http://sourcecodebrowser.com/mutrace/0.2.0/backtrace-symbols_8c_source.html >> > Yes, thanks, I've already noticed bfd_demangle, but the third argument is > flags which defined in demangle.h (of coarse it's only flags, but defining > them manually seems quite ugly for me). I found another alternative: > abi::__cxx_demangle() witch presents at least in gcc. > > Here is completely rewritten implementation of backtrace() functionality. > > some reasons why WITH_LIBBFD should be a separate option and should be OFF > by default: > - It's a yet another dependence. > - it's provides very specific and minor functionality. > - The functionality may be interested only for developers and some > testers. End users even won't have any ability to see the difference. > - Strictly speaking there is only one thing on linux-glibc-gcc system > (IMO > the most of trinity systems) which cannot be handled without libbfd: the > discovery of source code file and library if the binary was build with > debug info. > > the backtrase format is gdb-like : > > [WITH_LIBBFD=ON] no matter present demangle.h on system or not > #0 0x00007f0f16b6efe3 in kdBacktrace(int) in > /tmp/trinity/tdelibs/tdecore/kdebug.cpp:791 > #1 0x0000000000400f4b in MyNamespace::Foo::doFoo(int) from > ./a.out:0x00000f4b > #2 0x0000000000400e7d in MyNamespace::bar() from ./a.out:0x00000e7d > #3 0x0000000000400e88 in main from ./a.out:0x00000e88 > > [WITH_LIBBFD=OFF] the demangling is handled by abi::__cxx_demangle() > #0 0x00007f0f16b6efe3 in kdBacktrace(int) from > /tmp/tdelibs-build/tdecore/libtdecore.so:0x00139b55 > #1 0x0000000000400f4b in MyNamespace::Foo::doFoo(int) from > ./a.out:0x00000f4b > #2 0x0000000000400e7d in MyNamespace::bar() from ./a.out:0x00000e7d > #3 0x0000000000400e88 in main from ./a.out:0x00000e88 Looks good to me! Tim