From db169ed561acef18093cc6739fb159d6274bf5a5 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Wed, 28 Dec 2005 05:42:30 +0000 Subject: [PATCH] * sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h (PTR_MANGLE): Fix cast. * sysdeps/alpha/bits/setjmp.h (_JMPBUF_UNWINDS): Take third argument DEMANGLE, and pass SP value through it. * sysdeps/hppa/bits/setjmp.h (_JMPBUF_UNWINDS): Likewise. * sysdeps/i386/bits/setjmp.h (_JMPBUF_UNWINDS): Likewise. * sysdeps/m68k/bits/setjmp.h (_JMPBUF_UNWINDS): Likewise. * sysdeps/mips/bits/setjmp.h (_JMPBUF_UNWINDS): Likewise. * sysdeps/powerpc/bits/setjmp.h (_JMPBUF_UNWINDS): Likewise. * sysdeps/s390/bits/setjmp.h (_JMPBUF_UNWINDS): Likewise. * sysdeps/sh/bits/setjmp.h (_JMPBUF_UNWINDS): Likewise. * sysdeps/sparc/sparc32/bits/setjmp.h (_JMPBUF_UNWINDS): Likewise. * sysdeps/unix/sysv/linux/ia64/bits/setjmp.h: Likewise. * sysdeps/unix/sysv/linux/sparc/bits/setjmp.h: Likewise. * sysdeps/x86_64/bits/setjmp.h (_JMPBUF_UNWINDS): Likewise. * hurd/sigunwind.c (_hurdsig_longjmp_from_handler): Pass inline demangler function to _JMPBUF_UNWINDS. * sysdeps/mach/hurd/jmp-unwind.c (demangle_ptr): New function. (_longjmp_unwind): Pass it to _JMPBUF_UNWINDS. --- ChangeLog | 21 ++++++++++++++++++ hurd/sigunwind.c | 10 ++++++++- nptl/ChangeLog | 14 ++++++++++++ nptl/sysdeps/alpha/jmpbuf-unwind.h | 15 +++++++++++-- nptl/sysdeps/i386/jmpbuf-unwind.h | 15 +++++++++++-- nptl/sysdeps/mips/jmpbuf-unwind.h | 13 ++++++++++- nptl/sysdeps/powerpc/jmpbuf-unwind.h | 15 +++++++++++-- nptl/sysdeps/s390/jmpbuf-unwind.h | 18 ++++++++++++---- nptl/sysdeps/sh/jmpbuf-unwind.h | 17 ++++++++++++--- nptl/sysdeps/sparc/sparc32/jmpbuf-unwind.h | 15 +++++++++++-- nptl/sysdeps/sparc/sparc64/jmpbuf-unwind.h | 13 ++++++++++- nptl/sysdeps/unix/sysv/linux/ia64/jmpbuf-unwind.h | 25 ++++++++++++++++------ nptl/sysdeps/x86_64/jmpbuf-unwind.h | 15 +++++++++++-- sysdeps/alpha/bits/setjmp.h | 6 +++--- sysdeps/hppa/bits/setjmp.h | 7 +++--- sysdeps/i386/bits/setjmp.h | 6 +++--- sysdeps/m68k/bits/setjmp.h | 6 +++--- sysdeps/mach/hurd/jmp-unwind.c | 15 ++++++++++--- sysdeps/mips/bits/setjmp.h | 4 ++-- sysdeps/powerpc/bits/setjmp.h | 6 +++--- sysdeps/s390/bits/setjmp.h | 6 +++--- sysdeps/sh/bits/setjmp.h | 4 ++-- sysdeps/sparc/sparc32/bits/setjmp.h | 6 +++--- sysdeps/unix/sysv/linux/ia64/bits/setjmp.h | 6 +++--- sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h | 2 +- sysdeps/unix/sysv/linux/sparc/bits/setjmp.h | 10 ++++----- sysdeps/x86_64/bits/setjmp.h | 10 ++++----- 27 files changed, 231 insertions(+), 69 deletions(-) diff --git a/ChangeLog b/ChangeLog index b0577c701b..a2d062ebe4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,26 @@ 2005-12-27 Roland McGrath + * sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h + (PTR_MANGLE): Fix cast. + + * sysdeps/alpha/bits/setjmp.h (_JMPBUF_UNWINDS): Take third argument + DEMANGLE, and pass SP value through it. + * sysdeps/hppa/bits/setjmp.h (_JMPBUF_UNWINDS): Likewise. + * sysdeps/i386/bits/setjmp.h (_JMPBUF_UNWINDS): Likewise. + * sysdeps/m68k/bits/setjmp.h (_JMPBUF_UNWINDS): Likewise. + * sysdeps/mips/bits/setjmp.h (_JMPBUF_UNWINDS): Likewise. + * sysdeps/powerpc/bits/setjmp.h (_JMPBUF_UNWINDS): Likewise. + * sysdeps/s390/bits/setjmp.h (_JMPBUF_UNWINDS): Likewise. + * sysdeps/sh/bits/setjmp.h (_JMPBUF_UNWINDS): Likewise. + * sysdeps/sparc/sparc32/bits/setjmp.h (_JMPBUF_UNWINDS): Likewise. + * sysdeps/unix/sysv/linux/ia64/bits/setjmp.h: Likewise. + * sysdeps/unix/sysv/linux/sparc/bits/setjmp.h: Likewise. + * sysdeps/x86_64/bits/setjmp.h (_JMPBUF_UNWINDS): Likewise. + * hurd/sigunwind.c (_hurdsig_longjmp_from_handler): Pass inline + demangler function to _JMPBUF_UNWINDS. + * sysdeps/mach/hurd/jmp-unwind.c (demangle_ptr): New function. + (_longjmp_unwind): Pass it to _JMPBUF_UNWINDS. + * posix/tst-execle1.c (do_test): Add a const. * posix/tst-execle2.c (do_test): Likewise. diff --git a/hurd/sigunwind.c b/hurd/sigunwind.c index 2231518bd0..f6cb55454e 100644 --- a/hurd/sigunwind.c +++ b/hurd/sigunwind.c @@ -70,11 +70,19 @@ _hurdsig_longjmp_from_handler (void *data, jmp_buf env, int val) struct hurd_userlink *link; + inline uintptr_t demangle_ptr (uintptr_t x) + { +# ifdef PTR_DEMANGLE + PTR_DEMANGLE (x); +# endif + return x; + } + /* Continue _longjmp_unwind's job of running the unwind forms for frames being unwound, since we will not return to its loop like this one, which called us. */ for (link = ss->active_resources; - link && _JMPBUF_UNWINDS (env[0].__jmpbuf, link); + link && _JMPBUF_UNWINDS (env[0].__jmpbuf, link, demangle_ptr); link = link->thread.next) if (_hurd_userlink_unlink (link)) { diff --git a/nptl/ChangeLog b/nptl/ChangeLog index 14307c5140..137203ad9c 100644 --- a/nptl/ChangeLog +++ b/nptl/ChangeLog @@ -1,3 +1,17 @@ +2005-12-27 Roland McGrath + + * sysdeps/x86_64/jmpbuf-unwind.h (_jmpbuf_sp): New inline function. + (_JMPBUF_UNWINDS_ADJ): Use it, to PTR_DEMANGLE before comparison. + * sysdeps/alpha/jmpbuf-unwind.h: Likewise. + * sysdeps/i386/jmpbuf-unwind.h: Likewise. + * sysdeps/mips/jmpbuf-unwind.h: Likewise. + * sysdeps/powerpc/jmpbuf-unwind.h: Likewise. + * sysdeps/s390/jmpbuf-unwind.h: Likewise. + * sysdeps/sh/jmpbuf-unwind.h: Likewise. + * sysdeps/sparc/sparc32/jmpbuf-unwind.h: Likewise. + * sysdeps/sparc/sparc64/jmpbuf-unwind.h: Likewise. + * sysdeps/unix/sysv/linux/ia64/jmpbuf-unwind.h: Likewise. + 2005-12-27 Jakub Jelinek * sysdeps/unix/sysv/linux/alpha/bits/pthreadtypes.h: Add __next diff --git a/nptl/sysdeps/alpha/jmpbuf-unwind.h b/nptl/sysdeps/alpha/jmpbuf-unwind.h index 5cef8b1cf5..83b7a01a0e 100644 --- a/nptl/sysdeps/alpha/jmpbuf-unwind.h +++ b/nptl/sysdeps/alpha/jmpbuf-unwind.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek , 2003. @@ -20,12 +20,23 @@ #include #include #include +#include #define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \ _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj) +static inline uintptr_t __attribute__ ((unused)) +_jmpbuf_sp (__jmp_buf regs) +{ + uintptr_t sp = regs[JB_SP]; +#ifdef PTR_DEMANGLE + PTR_DEMANGLE (sp); +#endif + return sp; +} + #define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \ - ((uintptr_t) (_address) - (_adj) < (uintptr_t) (_jmpbuf)[JB_SP] - (_adj)) + ((uintptr_t) (_address) - (_adj) < _jmpbuf_sp (_jmpbuf) - (_adj)) /* We use the normal lobngjmp for unwinding. */ #define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val) diff --git a/nptl/sysdeps/i386/jmpbuf-unwind.h b/nptl/sysdeps/i386/jmpbuf-unwind.h index 5cef8b1cf5..83b7a01a0e 100644 --- a/nptl/sysdeps/i386/jmpbuf-unwind.h +++ b/nptl/sysdeps/i386/jmpbuf-unwind.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek , 2003. @@ -20,12 +20,23 @@ #include #include #include +#include #define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \ _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj) +static inline uintptr_t __attribute__ ((unused)) +_jmpbuf_sp (__jmp_buf regs) +{ + uintptr_t sp = regs[JB_SP]; +#ifdef PTR_DEMANGLE + PTR_DEMANGLE (sp); +#endif + return sp; +} + #define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \ - ((uintptr_t) (_address) - (_adj) < (uintptr_t) (_jmpbuf)[JB_SP] - (_adj)) + ((uintptr_t) (_address) - (_adj) < _jmpbuf_sp (_jmpbuf) - (_adj)) /* We use the normal lobngjmp for unwinding. */ #define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val) diff --git a/nptl/sysdeps/mips/jmpbuf-unwind.h b/nptl/sysdeps/mips/jmpbuf-unwind.h index 67cc969663..9ee03100e6 100644 --- a/nptl/sysdeps/mips/jmpbuf-unwind.h +++ b/nptl/sysdeps/mips/jmpbuf-unwind.h @@ -19,12 +19,23 @@ #include #include #include +#include #define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \ _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj) +static inline uintptr_t __attribute__ ((unused)) +_jmpbuf_sp (__jmp_buf regs) +{ + uintptr_t sp = regs[0].__sp; +#ifdef PTR_DEMANGLE + PTR_DEMANGLE (sp); +#endif + return sp; +} + #define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \ - ((uintptr_t) (_address) - (_adj) < (uintptr_t) (_jmpbuf)[0].__sp - (_adj)) + ((uintptr_t) (_address) - (_adj) < _jmpbuf_sp (_jmpbuf) - (_adj)) /* We use the normal longjmp for unwinding. */ #define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val) diff --git a/nptl/sysdeps/powerpc/jmpbuf-unwind.h b/nptl/sysdeps/powerpc/jmpbuf-unwind.h index 0b817160d3..d9090a591d 100644 --- a/nptl/sysdeps/powerpc/jmpbuf-unwind.h +++ b/nptl/sysdeps/powerpc/jmpbuf-unwind.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek , 2003. @@ -20,12 +20,23 @@ #include #include #include +#include #define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \ _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj) +static inline uintptr_t __attribute__ ((unused)) +_jmpbuf_sp (__jmp_buf regs) +{ + uintptr_t sp = regs[JB_GPR1]; +#ifdef PTR_DEMANGLE + PTR_DEMANGLE (sp); +#endif + return sp; +} + #define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \ - ((uintptr_t) (_address) - (_adj) < (uintptr_t) (_jmpbuf)[JB_GPR1] - (_adj)) + ((uintptr_t) (_address) - (_adj) < _jmpbuf_sp (_jmpbuf) - (_adj)) /* We use the normal lobngjmp for unwinding. */ #define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val) diff --git a/nptl/sysdeps/s390/jmpbuf-unwind.h b/nptl/sysdeps/s390/jmpbuf-unwind.h index 9f7e1ad583..81fa582540 100644 --- a/nptl/sysdeps/s390/jmpbuf-unwind.h +++ b/nptl/sysdeps/s390/jmpbuf-unwind.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek , 2003. @@ -21,6 +21,7 @@ #include #include #include +#include /* On s390{,x}, CFA is always 96 (resp. 160) bytes above actual %r15. */ @@ -29,9 +30,18 @@ (void *) (_Unwind_GetCFA (_context) \ - 32 - 2 * __WORDSIZE), _adj) -#define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \ - ((uintptr_t) (_address) - (_adj) \ - < (uintptr_t) (_jmpbuf)->__gregs[__JB_GPR15] - (_adj)) +static inline uintptr_t __attribute__ ((unused)) +_jmpbuf_sp (__jmp_buf regs) +{ + uintptr_t sp = regs[0].__gregs[__JB_GPR15]; +#ifdef PTR_DEMANGLE + PTR_DEMANGLE (sp); +#endif + return sp; +} + +#define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \ + ((uintptr_t) (_address) - (_adj) < _jmpbuf_sp (_jmpbuf) - (_adj)) /* We use the normal longjmp for unwinding. */ #define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val) diff --git a/nptl/sysdeps/sh/jmpbuf-unwind.h b/nptl/sysdeps/sh/jmpbuf-unwind.h index cf6d25f041..3ef178b4d6 100644 --- a/nptl/sysdeps/sh/jmpbuf-unwind.h +++ b/nptl/sysdeps/sh/jmpbuf-unwind.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek , 2003. @@ -20,12 +20,23 @@ #include #include #include +#include #define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \ _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj) -#define _JMPBUF_UNWINDS_ADJ(jmpbuf, address, adj) \ - ((uintptr_t) (address) - (adj) < (uintptr_t) (jmpbuf)[0].__regs[7] - (adj)) +static inline uintptr_t __attribute__ ((unused)) +_jmpbuf_sp (__jmp_buf regs) +{ + uintptr_t sp = regs[0].__regs[7]; +#ifdef PTR_DEMANGLE + PTR_DEMANGLE (sp); +#endif + return sp; +} + +#define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \ + ((uintptr_t) (_address) - (_adj) < _jmpbuf_sp (_jmpbuf) - (_adj)) /* We use the normal lobngjmp for unwinding. */ #define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val) diff --git a/nptl/sysdeps/sparc/sparc32/jmpbuf-unwind.h b/nptl/sysdeps/sparc/sparc32/jmpbuf-unwind.h index 5cef8b1cf5..83b7a01a0e 100644 --- a/nptl/sysdeps/sparc/sparc32/jmpbuf-unwind.h +++ b/nptl/sysdeps/sparc/sparc32/jmpbuf-unwind.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek , 2003. @@ -20,12 +20,23 @@ #include #include #include +#include #define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \ _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj) +static inline uintptr_t __attribute__ ((unused)) +_jmpbuf_sp (__jmp_buf regs) +{ + uintptr_t sp = regs[JB_SP]; +#ifdef PTR_DEMANGLE + PTR_DEMANGLE (sp); +#endif + return sp; +} + #define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \ - ((uintptr_t) (_address) - (_adj) < (uintptr_t) (_jmpbuf)[JB_SP] - (_adj)) + ((uintptr_t) (_address) - (_adj) < _jmpbuf_sp (_jmpbuf) - (_adj)) /* We use the normal lobngjmp for unwinding. */ #define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val) diff --git a/nptl/sysdeps/sparc/sparc64/jmpbuf-unwind.h b/nptl/sysdeps/sparc/sparc64/jmpbuf-unwind.h index 77321aad3f..7752fe971e 100644 --- a/nptl/sysdeps/sparc/sparc64/jmpbuf-unwind.h +++ b/nptl/sysdeps/sparc/sparc64/jmpbuf-unwind.h @@ -20,12 +20,23 @@ #include #include #include +#include #define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \ _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj) +static inline uintptr_t __attribute__ ((unused)) +_jmpbuf_sp (__jmp_buf regs) +{ + uintptr_t sp = regs[0].uc_mcontext.mc_fp; +#ifdef PTR_DEMANGLE + PTR_DEMANGLE (sp); +#endif + return sp; +} + #define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \ - ((uintptr_t) (_address) - (_adj) < (uintptr_t) (_jmpbuf)[0].uc_mcontext.mc_fp - (_adj)) + ((uintptr_t) (_address) - (_adj) < _jmpbuf_sp (_jmpbuf) - (_adj)) /* We use the normal lobngjmp for unwinding. */ #define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val) diff --git a/nptl/sysdeps/unix/sysv/linux/ia64/jmpbuf-unwind.h b/nptl/sysdeps/unix/sysv/linux/ia64/jmpbuf-unwind.h index c6ef5f7fbd..61411bdaa4 100644 --- a/nptl/sysdeps/unix/sysv/linux/ia64/jmpbuf-unwind.h +++ b/nptl/sysdeps/unix/sysv/linux/ia64/jmpbuf-unwind.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek , 2003. @@ -21,12 +21,23 @@ #include #include -#define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \ - ({ uintptr_t _cfa = (uintptr_t) _Unwind_GetCFA (_context) - (_adj); \ - (_cfa < (uintptr_t)(((long *)(_jmpbuf))[0]) - (_adj) \ - || (_cfa == (uintptr_t)(((long *)(_jmpbuf))[0]) - (_adj) \ - && (uintptr_t) _Unwind_GetBSP (_context) - (_adj) \ - >= (uintptr_t)(((long *)(_jmpbuf))[17]) - (_adj))); \ +static inline uintptr_t __attribute__ ((unused)) +_jmpbuf_sp (__jmp_buf regs, int i) +{ + uintptr_t sp = ((unsigned long int *) regs)[i]; +#ifdef PTR_DEMANGLE + PTR_DEMANGLE (sp); +#endif + return sp; +} + + +#define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \ + ({ uintptr_t _cfa = (uintptr_t) _Unwind_GetCFA (_context) - (_adj); \ + (_cfa < _jmpbuf_sp (_jmpbuf, 0) - (_adj) \ + || (_cfa == (uintptr_t)(((long *)(_jmpbuf))[0]) - (_adj) \ + && ((uintptr_t) _Unwind_GetBSP (_context) - (_adj) \ + >= _jmpbuf_sp (_jmpbuf, 17) - (_adj)))); \ }) #define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \ diff --git a/nptl/sysdeps/x86_64/jmpbuf-unwind.h b/nptl/sysdeps/x86_64/jmpbuf-unwind.h index 345ed557c5..1a36c53d11 100644 --- a/nptl/sysdeps/x86_64/jmpbuf-unwind.h +++ b/nptl/sysdeps/x86_64/jmpbuf-unwind.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek , 2003. @@ -20,12 +20,23 @@ #include #include #include +#include #define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \ _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj) +static inline uintptr_t __attribute__ ((unused)) +_jmpbuf_sp (__jmp_buf regs) +{ + uintptr_t sp = regs[JB_RSP]; +#ifdef PTR_DEMANGLE + PTR_DEMANGLE (sp); +#endif + return sp; +} + #define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \ - ((uintptr_t) (_address) - (_adj) < (uintptr_t) (_jmpbuf)[JB_RSP] - (_adj)) + ((uintptr_t) (_address) - (_adj) < _jmpbuf_sp (_jmpbuf) - (_adj)) /* We use the normal lobngjmp for unwinding. */ #define __libc_unwind_longjmp(buf, val) __libc_longjmp (buf, val) diff --git a/sysdeps/alpha/bits/setjmp.h b/sysdeps/alpha/bits/setjmp.h index c603a35554..71b7738c37 100644 --- a/sysdeps/alpha/bits/setjmp.h +++ b/sysdeps/alpha/bits/setjmp.h @@ -1,5 +1,5 @@ /* Define the machine-dependent type `jmp_buf'. Alpha version. - Copyright (C) 1992, 1997, 2003 Free Software Foundation, Inc. + Copyright (C) 1992, 1997, 2003, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -80,8 +80,8 @@ typedef long int __jmp_buf[17]; /* Test if longjmp to JMPBUF would unwind the frame containing a local variable at ADDRESS. */ -#define _JMPBUF_UNWINDS(_jmpbuf, _address) \ - ((void *)(_address) < (void *)((_jmpbuf)[JB_SP])) +#define _JMPBUF_UNWINDS(_jmpbuf, _address, _demangle) \ + ((void *)(_address) < (void *) _demangle ((_jmpbuf)[JB_SP])) #endif #endif /* bits/setjmp.h */ diff --git a/sysdeps/hppa/bits/setjmp.h b/sysdeps/hppa/bits/setjmp.h index 4395b8f562..07ea01eb97 100644 --- a/sysdeps/hppa/bits/setjmp.h +++ b/sysdeps/hppa/bits/setjmp.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -39,7 +39,8 @@ typedef double __jmp_buf[21]; /* Test if longjmp to JMPBUF would unwind the frame containing a local variable at ADDRESS. */ -#define _JMPBUF_UNWINDS(_jmpbuf, _address) \ - ((void *)(_address) > (void *)(((unsigned long *) _jmpbuf)[JB_SP])) +#define _JMPBUF_UNWINDS(_jmpbuf, _address, _demangle) \ + ((void *) (_address) > \ + (void *) _demangle ((((unsigned long *) _jmpbuf)[JB_SP]))) #endif /* bits/setjmp.h */ diff --git a/sysdeps/i386/bits/setjmp.h b/sysdeps/i386/bits/setjmp.h index 107fe58b35..d99a726ba3 100644 --- a/sysdeps/i386/bits/setjmp.h +++ b/sysdeps/i386/bits/setjmp.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998, 2000, 2001, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998, 2000, 2001, 2003, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -40,7 +40,7 @@ typedef int __jmp_buf[6]; /* Test if longjmp to JMPBUF would unwind the frame containing a local variable at ADDRESS. */ -#define _JMPBUF_UNWINDS(jmpbuf, address) \ - ((void *) (address) < (void *) (jmpbuf)[JB_SP]) +#define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \ + ((void *) (address) < (void *) demangle ((jmpbuf)[JB_SP])) #endif /* bits/setjmp.h */ diff --git a/sysdeps/m68k/bits/setjmp.h b/sysdeps/m68k/bits/setjmp.h index 193eec3509..612582af26 100644 --- a/sysdeps/m68k/bits/setjmp.h +++ b/sysdeps/m68k/bits/setjmp.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -44,7 +44,7 @@ typedef struct /* Test if longjmp to JMPBUF would unwind the frame containing a local variable at ADDRESS. */ -#define _JMPBUF_UNWINDS(jmpbuf, address) \ - ((void *) (address) < (void *) (jmpbuf)->__sp) +#define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \ + ((void *) (address) < (void *) demangle ((jmpbuf)->__sp)) #endif /* bits/setjmp.h */ diff --git a/sysdeps/mach/hurd/jmp-unwind.c b/sysdeps/mach/hurd/jmp-unwind.c index 4624ad9e26..0c9700b739 100644 --- a/sysdeps/mach/hurd/jmp-unwind.c +++ b/sysdeps/mach/hurd/jmp-unwind.c @@ -1,5 +1,5 @@ /* _longjmp_unwind -- Clean up stack frames unwound by longjmp. Hurd version. - Copyright (C) 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -28,6 +28,15 @@ #error " fails to define _JMPBUF_UNWINDS" #endif +static inline uintptr_t +demangle_ptr (uintptr_t x) +{ +# ifdef PTR_DEMANGLE + PTR_DEMANGLE (x); +# endif + return x; +} + /* This function is called by `longjmp' (with its arguments) to restore active resources to a sane state before the frames code using them are jumped out of. */ @@ -46,7 +55,7 @@ _longjmp_unwind (jmp_buf env, int val) /* Remove local signal preemptors being unwound past. */ while (ss->preemptors && - _JMPBUF_UNWINDS (env[0].__jmpbuf, ss->preemptors)) + _JMPBUF_UNWINDS (env[0].__jmpbuf, ss->preemptors, demangle_ptr)) ss->preemptors = ss->preemptors->next; __spin_unlock (&ss->lock); @@ -56,7 +65,7 @@ _longjmp_unwind (jmp_buf env, int val) in stack frames being unwound by this jump. */ for (link = ss->active_resources; - link && _JMPBUF_UNWINDS (env[0].__jmpbuf, link); + link && _JMPBUF_UNWINDS (env[0].__jmpbuf, link, demangle_ptr); link = link->thread.next) /* Remove this link from the resource's users list, since the frame using the resource is being unwound. diff --git a/sysdeps/mips/bits/setjmp.h b/sysdeps/mips/bits/setjmp.h index 74caae8cba..5f7c82b864 100644 --- a/sysdeps/mips/bits/setjmp.h +++ b/sysdeps/mips/bits/setjmp.h @@ -80,7 +80,7 @@ typedef struct /* Test if longjmp to JMPBUF would unwind the frame containing a local variable at ADDRESS. */ -#define _JMPBUF_UNWINDS(jmpbuf, address) \ - ((void *) (address) < (void *) (jmpbuf)[0].__sp) +#define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \ + ((void *) (address) < (void *) demangle ((jmpbuf)[0].__sp)) #endif /* _MIPS_BITS_SETJMP_H */ diff --git a/sysdeps/powerpc/bits/setjmp.h b/sysdeps/powerpc/bits/setjmp.h index 3134916a51..6b35fb440b 100644 --- a/sysdeps/powerpc/bits/setjmp.h +++ b/sysdeps/powerpc/bits/setjmp.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998, 2000, 2003, 2004 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -74,7 +74,7 @@ typedef long int __jmp_buf[64 + (12 * 4)] __attribute__ ((__aligned__ (16))); /* Test if longjmp to JMPBUF would unwind the frame containing a local variable at ADDRESS. */ -#define _JMPBUF_UNWINDS(jmpbuf, address) \ - ((void *) (address) < (void *) (jmpbuf)[JB_GPR1]) +#define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \ + ((void *) (address) < (void *) demangle ((jmpbuf)[JB_GPR1])) #endif /* bits/setjmp.h */ diff --git a/sysdeps/s390/bits/setjmp.h b/sysdeps/s390/bits/setjmp.h index 4009514763..01533ca367 100644 --- a/sysdeps/s390/bits/setjmp.h +++ b/sysdeps/s390/bits/setjmp.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc. +/* Copyright (C) 2000, 2001, 2002, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -57,7 +57,7 @@ typedef struct { /* Test if longjmp to JMPBUF would unwind the frame containing a local variable at ADDRESS. */ -#define _JMPBUF_UNWINDS(jmpbuf, address) \ - ((void *) (address) < (void *) (jmpbuf)->__gregs[__JB_GPR15]) +#define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \ + ((void *) (address) < (void *) demangle ((jmpbuf)->__gregs[__JB_GPR15])) #endif /* __S390_SETJMP_H__ */ diff --git a/sysdeps/sh/bits/setjmp.h b/sysdeps/sh/bits/setjmp.h index 242720ca53..8ebb5c598e 100644 --- a/sysdeps/sh/bits/setjmp.h +++ b/sysdeps/sh/bits/setjmp.h @@ -50,7 +50,7 @@ typedef struct /* Test if longjmp to JMPBUF would unwind the frame containing a local variable at ADDRESS. */ -#define _JMPBUF_UNWINDS(jmpbuf, address) \ - ((void *) (address) < (void *) (jmpbuf)[0].__regs[7]) +#define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \ + ((void *) (address) < (void *) demangle ((jmpbuf)[0].__regs[7])) #endif /* bits/setjmp.h */ diff --git a/sysdeps/sparc/sparc32/bits/setjmp.h b/sysdeps/sparc/sparc32/bits/setjmp.h index 76d7af02c7..12250d6980 100644 --- a/sysdeps/sparc/sparc32/bits/setjmp.h +++ b/sysdeps/sparc/sparc32/bits/setjmp.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -34,5 +34,5 @@ typedef int __jmp_buf[3]; /* Test if longjmp to JMPBUF would unwind the frame containing a local variable at ADDRESS. */ -#define _JMPBUF_UNWINDS(jmpbuf, address) \ - ((int) (address) < (jmpbuf)[JB_SP]) +#define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \ + ((int) (address) < demangle ((jmpbuf)[JB_SP])) diff --git a/sysdeps/unix/sysv/linux/ia64/bits/setjmp.h b/sysdeps/unix/sysv/linux/ia64/bits/setjmp.h index 76625753d9..07d4d80958 100644 --- a/sysdeps/unix/sysv/linux/ia64/bits/setjmp.h +++ b/sysdeps/unix/sysv/linux/ia64/bits/setjmp.h @@ -1,5 +1,5 @@ /* Define the machine-dependent type `jmp_buf'. Linux/IA-64 version. - Copyright (C) 1999, 2000, 2003 Free Software Foundation, Inc. + Copyright (C) 1999, 2000, 2003, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by David Mosberger-Tang . @@ -34,7 +34,7 @@ typedef long __jmp_buf[_JBLEN] __attribute__ ((aligned (16))); /* guarantees 128 /* Test if longjmp to JMPBUF would unwind the frame containing a local variable at ADDRESS. */ -#define _JMPBUF_UNWINDS(_jmpbuf, _address) \ - ((void *)(_address) < (void *)(((long *)_jmpbuf)[0])) +#define _JMPBUF_UNWINDS(_jmpbuf, _address, _demangle) \ + ((void *) (_address) < (void *) demangle (((long int *) _jmpbuf)[0])) #endif /* bits/setjmp.h */ diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h b/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h index 546e712edc..d3cd45ce99 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h @@ -183,7 +183,7 @@ # define PTR_DEMANGLE(reg, tmpreg) PTR_MANGLE (reg, tmpreg) # else # define PTR_MANGLE(var) \ - (var) = (void *) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ()) + (var) = (__typeof (var)) ((uintptr_t) (var) ^ THREAD_GET_POINTER_GUARD ()) # define PTR_DEMANGLE(var) PTR_MANGLE (var) # endif #endif diff --git a/sysdeps/unix/sysv/linux/sparc/bits/setjmp.h b/sysdeps/unix/sysv/linux/sparc/bits/setjmp.h index dac9ac5cba..45aa2655ee 100644 --- a/sysdeps/unix/sysv/linux/sparc/bits/setjmp.h +++ b/sysdeps/unix/sysv/linux/sparc/bits/setjmp.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997,1999,2000,2003 Free Software Foundation, Inc. +/* Copyright (C) 1997,1999,2000,2003, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -59,8 +59,8 @@ typedef struct __sparc64_jmp_buf /* Test if longjmp to JMPBUF would unwind the frame containing a local variable at ADDRESS. */ -#define _JMPBUF_UNWINDS(jmpbuf, address) \ - ((unsigned long int) (address) < (jmpbuf)->uc_mcontext.mc_fp) +#define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \ + ((unsigned long int) (address) < demangle ((jmpbuf)->uc_mcontext.mc_fp)) #else @@ -76,8 +76,8 @@ typedef int __jmp_buf[3]; /* Test if longjmp to JMPBUF would unwind the frame containing a local variable at ADDRESS. */ -#define _JMPBUF_UNWINDS(jmpbuf, address) \ - ((int) (address) < (jmpbuf)[JB_SP]) +#define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \ + ((int) (address) < demangle ((jmpbuf)[JB_SP])) #endif diff --git a/sysdeps/x86_64/bits/setjmp.h b/sysdeps/x86_64/bits/setjmp.h index 96646efdda..1031d5027b 100644 --- a/sysdeps/x86_64/bits/setjmp.h +++ b/sysdeps/x86_64/bits/setjmp.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. +/* Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -67,11 +67,11 @@ typedef int __jmp_buf[6]; /* Test if longjmp to JMPBUF would unwind the frame containing a local variable at ADDRESS. */ # if __WORDSIZE == 64 -# define _JMPBUF_UNWINDS(jmpbuf, address) \ - ((void *) (address) < (void *) (jmpbuf)[JB_RSP]) +# define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \ + ((void *) (address) < (void *) demangle ((jmpbuf)[JB_RSP])) # else -# define _JMPBUF_UNWINDS(jmpbuf, address) \ - ((void *) (address) < (void *) (jmpbuf)[JB_SP]) +# define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \ + ((void *) (address) < (void *) demangle ((jmpbuf)[JB_SP])) # endif #endif -- 2.11.4.GIT