diff options
Diffstat (limited to 'gcc-4.6/gcc/ada/init.c')
-rw-r--r-- | gcc-4.6/gcc/ada/init.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/gcc-4.6/gcc/ada/init.c b/gcc-4.6/gcc/ada/init.c index 9b6370e..f6c1a5b 100644 --- a/gcc-4.6/gcc/ada/init.c +++ b/gcc-4.6/gcc/ada/init.c @@ -2216,12 +2216,33 @@ __gnat_is_stack_guard (mach_vm_address_t addr) return 0; } +#define HAVE_GNAT_ADJUST_CONTEXT_FOR_RAISE + +void +__gnat_adjust_context_for_raise (int signo ATTRIBUTE_UNUSED, + void *ucontext ATTRIBUTE_UNUSED) +{ +#if defined (__x86_64__) + /* Work around radar #10302855/pr50678, where the unwinders (libunwind or + libgcc_s depending on the system revision) and the DWARF unwind data for + the sigtramp have different ideas about register numbering (causing rbx + and rdx to be transposed).. */ + ucontext_t *uc = (ucontext_t *)ucontext ; + unsigned long t = uc->uc_mcontext->__ss.__rbx; + + uc->uc_mcontext->__ss.__rbx = uc->uc_mcontext->__ss.__rdx; + uc->uc_mcontext->__ss.__rdx = t; +#endif +} + static void -__gnat_error_handler (int sig, siginfo_t *si, void *ucontext ATTRIBUTE_UNUSED) +__gnat_error_handler (int sig, siginfo_t *si, void *ucontext) { struct Exception_Data *exception; const char *msg; + __gnat_adjust_context_for_raise (sig, ucontext); + switch (sig) { case SIGSEGV: |