http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46686
--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-05-14 21:11:07 UTC --- (In reply to comment #1) > The generic code below relies on libgcc routines, it should work anywhere, > doesn't it? Well, on x86-64-linux, I needed at least the following modifications: - #include "libgfortran.h" - #include <stdint.h> /* For uintptr_t. */ - On Linux Dl_info does not work by default; as man dladdr states: Glibc adds two functions not described by POSIX, with prototypes #define _GNU_SOURCE /* See feature_test_macros(7) */ #include <dlfcn.h> one could assume that _GNU_SOURCE had do be defined - but that does not work. With #define __USE_GNU it works - trace_function: The unused parameter gives a fatal warning - thus, I used __attribute__((undefined)). Then it compiles - but linking an executable fails with: "undefined reference to `dladdr", unless I link with "-ldl". But then I get a backtrace of the form: 0x2af48a719fa7 0x2af48a7e2019 0x400698 0x400688 0x40067d 0x4006a1 0x4006d7 0x2af48b0dbbfd (__libc_start_main) * * * Regarding the functionality * libgo/configure.ac has the check: GCC_CHECK_UNWIND_GETIPINFO Ditto for libada, libjava and libstdc++-v3. Thus, we might pick some functionality from: * libgo/runtime/go-unwind.c * libjava/exception.cc * libjava/stacktrace.cc