I want to provide a generic call stack function as part of a library (.so) using libunwind
. However, executables linked against the .so start to fail as soon as I link against libunwind
. As I understand it, the problem I'm running into is that libunwind
defines the same symbols as the GCC runtime, but the implementation is seemingly not compatible.
Linking statically or dynamically against libunwind
doesn't change anything, I get a segfault when throwing an exception in _Unwind_Resume
(if linked statically), otherwise the call-stack starts at __cxa_throw
(presumably, it has been damaged before.)
Interestingly, the problems only occur when I use GCC, with Clang, everything works just fine.
Is it possible to use libunwind
inside a shared library? If not, is there another library which allows me to obtained the name plus instruction pointer offset of the functions on the stack? backtrace()
is nearly good enough, but backtrace_symbols()
is doing too much formatting which I would have to "un-parse" first.