]>
Commit | Line | Data |
---|---|---|
2b778ceb | 1 | /* Copyright (C) 2003-2021 Free Software Foundation, Inc. |
d5efd131 | 2 | This file is part of the GNU C Library. |
d5efd131 MF |
3 | |
4 | The GNU C Library is free software; you can redistribute it and/or | |
5 | modify it under the terms of the GNU Lesser General Public | |
6 | License as published by the Free Software Foundation; either | |
7 | version 2.1 of the License, or (at your option) any later version. | |
8 | ||
9 | The GNU C Library is distributed in the hope that it will be useful, | |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
12 | Lesser General Public License for more details. | |
13 | ||
14 | You should have received a copy of the GNU Lesser General Public | |
75efb018 | 15 | License along with the GNU C Library; if not, see |
5a82c748 | 16 | <https://www.gnu.org/licenses/>. */ |
d5efd131 MF |
17 | |
18 | #include <setjmp.h> | |
19 | #include <stdint.h> | |
20 | #include <unwind.h> | |
21 | ||
22 | /* Test if longjmp to JMPBUF would unwind the frame containing a local | |
23 | variable at ADDRESS. */ | |
24 | #define _JMPBUF_UNWINDS(_jmpbuf, _address, _demangle) \ | |
25 | ((void *) (_address) < (void *) (((long int *) _jmpbuf)[0])) | |
26 | ||
27 | #define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \ | |
28 | ({ uintptr_t _cfa = (uintptr_t) _Unwind_GetCFA (_context) - (_adj); \ | |
29 | (_cfa < (uintptr_t)(((long *)(_jmpbuf))[0]) - (_adj) \ | |
30 | || (_cfa == (uintptr_t)(((long *)(_jmpbuf))[0]) - (_adj) \ | |
31 | && (uintptr_t) _Unwind_GetBSP (_context) - (_adj) \ | |
32 | >= (uintptr_t)(((long *)(_jmpbuf))[17]) - (_adj))); \ | |
33 | }) | |
34 | ||
35 | #define _JMPBUF_UNWINDS_ADJ(_jmpbuf, _address, _adj) \ | |
36 | ((uintptr_t)(_address) - (_adj) < (uintptr_t)(((long *)_jmpbuf)[0]) - (_adj)) | |
37 | ||
38 | /* We use a longjmp() which can cross from the alternate signal-stack | |
39 | to the normal stack. */ | |
40 | extern void __libc_unwind_longjmp (sigjmp_buf env, int val) | |
41 | __attribute__ ((noreturn)); | |
42 | hidden_proto (__libc_unwind_longjmp) |