> -----Ursprüngliche Nachricht----- > Von: Andrew Stubbs [mailto:a...@codesourcery.com] > Gesendet: Montag, 19. März 2012 17:12 > An: EXTERNAL Waechtler Peter (Fa. TCP, CM-AI/PJ-CF31) > Cc: gcc-patches@gcc.gnu.org; libstd...@gcc.gnu.org; > p...@codesourcery.com; pwaecht...@mac.com; d...@false.org > Betreff: Re: [PATCH] eh_personality.cc: unwinding on ARM > > On 16/03/12 13:29, EXTERNAL Waechtler Peter (Fa. TCP, > CM-AI/PJ-CF31) wrote: > > The CodeSourcery toolchain contains a "fix" like the following, > > please consider for adding it. > > Here's the full original patch with ChangeLog. > > I don't know why Dan never submitted this one. Perhaps it's > not suitable > for upstream or not considered the correct fix? > > Anyway, as far as copyright goes, I don't believe > CodeSourcery has any > problem with this being committed. >
And here is a stub for a test case. I don't know how to run the testsuite, just put in include and VERIFY-thingie #include <unistd.h> #include <stdlib.h> #include <string.h> #include <signal.h> #include <execinfo.h> #include <iostream> #include <vector> using namespace std; static void abort_handler(int n_signal, siginfo_t *siginfo, void *ptr); static void abort_handler(int n_signal, siginfo_t *siginfo, void *ptr) { void *address[20]; int depth; depth = backtrace(address, sizeof(address)/sizeof(void*)); backtrace_symbols_fd(address, depth, 0); /* this is a dumb check, better look for main */ if (depth == sizeof(address)/sizeof(void*)) cerr << "failed" << endl; else cerr << "passed" << endl; } int tst_eh01(void) { int rc = 0; std::vector<int> v(10); rc = v.at(42); return rc; } int main(int argc, char *argv[]) { int c; struct sigaction sa; memset(&sa, 0 , sizeof(sa)); sa.sa_sigaction = abort_handler; sa.sa_flags = SA_SIGINFO; sigaction(SIGABRT, &sa, NULL); c = tst_eh01(); return c; } With a fixed CodeSourcery version: cs-minimal-sysroot/usr/lib/bin/sysroot-qemu src/bt/tst-eh01 terminate called after throwing an instance of 'std::out_of_range' what(): vector::_M_range_check src/bt/tst-eh01[0x9654] cs-minimal-sysroot/usr/lib/bin/../../../lib/libc.so.6(__default_rt_sa_restorer_v1+0x0)[0x40a06ce0] cs-minimal-sysroot/usr/lib/bin/../../../lib/libc.so.6(gsignal+0x40)[0x40a059bc] cs-minimal-sysroot/usr/lib/bin/../../../lib/libc.so.6(abort+0x1d4)[0x40a0acec] cs-minimal-sysroot/usr/lib/bin/../../../usr/lib/libstdc++.so.6(_ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x110)[0x408e5f4c] cs-minimal-sysroot/usr/lib/bin/../../../usr/lib/libstdc++.so.6(+0xa707c)[0x408e407c] cs-minimal-sysroot/usr/lib/bin/../../../usr/lib/libstdc++.so.6(_ZSt9terminatev+0x1c)[0x408e40a4] cs-minimal-sysroot/usr/lib/bin/../../../usr/lib/libstdc++.so.6(__cxa_throw+0x9c)[0x408e4220] cs-minimal-sysroot/usr/lib/bin/../../../usr/lib/libstdc++.so.6(_ZSt20__throw_out_of_rangePKc+0x64)[0x4088dc04] src/bt/tst-eh01(_ZNKSt6vectorIiSaIiEE14_M_range_checkEj+0x44)[0x9c24] src/bt/tst-eh01(_ZNSt6vectorIiSaIiEE2atEj+0x20)[0x99a8] src/bt/tst-eh01(_Z8tst_eh01v+0x5c)[0x972c] src/bt/tst-eh01(main+0x50)[0x97c8] cs-minimal-sysroot/usr/lib/bin/../../../lib/libc.so.6(__libc_start_main+0x114)[0x409ee754] passed qemu: uncaught target signal 6 (Aborted) - core dumped Aborted with an unfixed version: $ ./tst-eh01 terminate called after throwing an instance of 'std::out_of_range' what(): vector::_M_range_check ./tst-eh01[0x9580] /lib/libc.so.6(__default_rt_sa_restorer_v2+0x0)[0x4c883770] /lib/libc.so.6(gsignal+0x40)[0x4c88241c] /lib/libc.so.6(abort+0x1c0)[0x4c88680c] /lib/libstdc++.so.6(_ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x134)[0x4cb2ca0c] /lib/libstdc++.so.6(_ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x134)[0x4cb2ca0c] /lib/libstdc++.so.6(_ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x134)[0x4cb2ca0c] /lib/libstdc++.so.6(_ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x134)[0x4cb2ca0c] /lib/libstdc++.so.6(_ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x134)[0x4cb2ca0c] /lib/libstdc++.so.6(_ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x134)[0x4cb2ca0c] /lib/libstdc++.so.6(_ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x134)[0x4cb2ca0c] /lib/libstdc++.so.6(_ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x134)[0x4cb2ca0c] /lib/libstdc++.so.6(_ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x134)[0x4cb2ca0c] /lib/libstdc++.so.6(_ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x134)[0x4cb2ca0c] /lib/libstdc++.so.6(_ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x134)[0x4cb2ca0c] /lib/libstdc++.so.6(_ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x134)[0x4cb2ca0c] /lib/libstdc++.so.6(_ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x134)[0x4cb2ca0c] /lib/libstdc++.so.6(_ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x134)[0x4cb2ca0c] /lib/libstdc++.so.6(_ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x134)[0x4cb2ca0c] /lib/libstdc++.so.6(_ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x134)[0x4cb2ca0c] failed Aborted