diff options
author | Ulrich Weigand <uweigand@de.ibm.com> | 2006-07-14 16:43:27 +0000 |
---|---|---|
committer | Ulrich Weigand <uweigand@gcc.gnu.org> | 2006-07-14 16:43:27 +0000 |
commit | 47a4949a8ea5f52c72cba00912fd652c57197eae (patch) | |
tree | debe851ba24d5899c3687e8620210d4c19b222af | |
parent | 03471b3fcd6dd21855ba0ed90b7963d90904b08b (diff) | |
download | gcc-47a4949a8ea5f52c72cba00912fd652c57197eae.zip gcc-47a4949a8ea5f52c72cba00912fd652c57197eae.tar.gz gcc-47a4949a8ea5f52c72cba00912fd652c57197eae.tar.bz2 |
linux-unwind.h (s390_fallback_frame_state): Detect signal frames correctly even when the signal was installed with...
* config/s390/linux-unwind.h (s390_fallback_frame_state): Detect
signal frames correctly even when the signal was installed with
sa_restorer set.
From-SVN: r115448
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/config/s390/linux-unwind.h | 31 |
2 files changed, 27 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5a604c0..4cdb0ac 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2006-07-14 Ulrich Weigand <uweigand@de.ibm.com> + + * config/s390/linux-unwind.h (s390_fallback_frame_state): Detect + signal frames correctly even when the signal was installed with + sa_restorer set. + 2006-07-14 Carlos O'Donell <carlos@codesoucery.com> diff --git a/gcc/config/s390/linux-unwind.h b/gcc/config/s390/linux-unwind.h index d1e9b73..221a5d4 100644 --- a/gcc/config/s390/linux-unwind.h +++ b/gcc/config/s390/linux-unwind.h @@ -51,17 +51,33 @@ s390_fallback_frame_state (struct _Unwind_Context *context, } __attribute__ ((__aligned__ (8))) sigregs_; sigregs_ *regs; - int *signo = NULL; + int *signo; /* svc $__NR_sigreturn or svc $__NR_rt_sigreturn */ if (pc[0] != 0x0a || (pc[1] != 119 && pc[1] != 173)) return _URC_END_OF_STACK; + /* Legacy frames: + old signal mask (8 bytes) + pointer to sigregs (8 bytes) - points always to next location + sigregs + retcode + This frame layout was used on kernels < 2.6.9 for non-RT frames, + and on kernels < 2.4.13 for RT frames as well. Note that we need + to look at RA to detect this layout -- this means that if you use + sa_restorer to install a different signal restorer on a legacy + kernel, unwinding from signal frames will not work. */ + if (context->ra == context->cfa + 16 + sizeof (sigregs_)) + { + regs = (sigregs_ *)(context->cfa + 16); + signo = NULL; + } + /* New-style RT frame: retcode + alignment (8 bytes) siginfo (128 bytes) ucontext (contains sigregs) */ - if (context->ra == context->cfa) + else if (pc[1] == 173 /* __NR_rt_sigreturn */) { struct ucontext_ { @@ -75,18 +91,13 @@ s390_fallback_frame_state (struct _Unwind_Context *context, signo = context->cfa + sizeof(long); } - /* Old-style RT frame and all non-RT frames: + /* New-style non-RT frame: old signal mask (8 bytes) - pointer to sigregs */ + pointer to sigregs (followed by signal number) */ else { regs = *(sigregs_ **)(context->cfa + 8); - - /* Recent kernels store the signal number immediately after - the sigregs; old kernels have the return trampoline at - this location. */ - if ((void *)(regs + 1) != context->ra) - signo = (int *)(regs + 1); + signo = (int *)(regs + 1); } new_cfa = regs->gprs[15] + 16*sizeof(long) + 32; |