mirror of
https://github.com/tobast/libunwind-eh_elf.git
synced 2024-12-24 12:13:42 +01:00
Include <assert.h>.
(_longjmp): Ensure that we have at least 4 exception-handling args. (This code will need updating to make it work on x86, where only 2 exception handling args are available). (longjmp): If we are compiling with GCC, use an alias-attribute to alias it with _longjmp(). This is more efficient and works around a gcc-3.2/ia64 bug which causes bad unwind info when a noreturn function is a last call. (Logical change 1.59)
This commit is contained in:
parent
eeffb605f7
commit
00c5dee16b
1 changed files with 14 additions and 4 deletions
|
@ -25,6 +25,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|||
|
||||
#define UNW_LOCAL_ONLY
|
||||
|
||||
#include <assert.h>
|
||||
#include <libunwind.h>
|
||||
#include <setjmp.h>
|
||||
#include <signal.h>
|
||||
|
@ -71,14 +72,17 @@ _longjmp (jmp_buf env, int val)
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* found the right frame: */
|
||||
|
||||
if (sigprocmask (SIG_BLOCK, NULL, ¤t_mask) < 0)
|
||||
abort ();
|
||||
|
||||
if (unw_set_reg (&c, UNW_REG_EH_ARG0, wp[1]) < 0
|
||||
|| unw_set_reg (&c, UNW_REG_EH_ARG1, val) < 0
|
||||
|| unw_set_reg (&c, UNW_REG_EH_ARG2,
|
||||
assert (UNW_NUM_EH_REGS >= 4);
|
||||
|
||||
if (unw_set_reg (&c, UNW_REG_EH + 0, wp[1]) < 0
|
||||
|| unw_set_reg (&c, UNW_REG_EH + 1, val) < 0
|
||||
|| unw_set_reg (&c, UNW_REG_EH + 2,
|
||||
((unw_word_t *) ¤t_mask)[0]) < 0
|
||||
|| unw_set_reg (&c, UNW_REG_IP,
|
||||
(unw_word_t) &_UI_siglongjmp_cont))
|
||||
|
@ -88,7 +92,7 @@ _longjmp (jmp_buf env, int val)
|
|||
{
|
||||
if (_NSIG > 16 * sizeof (unw_word_t))
|
||||
abort ();
|
||||
if (unw_set_reg (&c, UNW_REG_EH_ARG3,
|
||||
if (unw_set_reg (&c, UNW_REG_EH + 3,
|
||||
((unw_word_t *) ¤t_mask)[1]) < 0)
|
||||
abort ();
|
||||
}
|
||||
|
@ -102,8 +106,14 @@ _longjmp (jmp_buf env, int val)
|
|||
abort ();
|
||||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
void longjmp (jmp_buf env, int val) __attribute__ ((alias ("_longjmp")));
|
||||
#else
|
||||
|
||||
void
|
||||
longjmp (jmp_buf env, int val)
|
||||
{
|
||||
_longjmp (env, val);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue