1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-11-05 01:09:27 +01:00

Make setjmp/longjmp work at least on FreeBSD/amd64.

FreeBSD-supplied setjmp() saves incremented stack pointer into jmpbuf.

I have no idea whether siglongjmp ever worked on amd64, since
UNW_NUM_EH_REGS == 2 and abort at siglongjmp.c:81 is firing.
This commit is contained in:
Konstantin Belousov 2010-04-03 19:02:43 +03:00
parent 31ece3eaa1
commit 5715d912f4
2 changed files with 8 additions and 0 deletions

View file

@ -50,7 +50,11 @@ _longjmp (jmp_buf env, int val)
{ {
if (unw_get_reg (&c, UNW_REG_SP, &sp) < 0) if (unw_get_reg (&c, UNW_REG_SP, &sp) < 0)
abort (); abort ();
#ifdef __FreeBSD__
if (sp != wp[JB_SP] + sizeof(unw_word_t))
#else
if (sp != wp[JB_SP]) if (sp != wp[JB_SP])
#endif
continue; continue;
if (!bsp_match (&c, wp)) if (!bsp_match (&c, wp))

View file

@ -53,7 +53,11 @@ siglongjmp (sigjmp_buf env, int val)
{ {
if (unw_get_reg (&c, UNW_REG_SP, &sp) < 0) if (unw_get_reg (&c, UNW_REG_SP, &sp) < 0)
abort (); abort ();
#ifdef __FreeBSD__
if (sp != wp[JB_SP] + sizeof(unw_word_t))
#else
if (sp != wp[JB_SP]) if (sp != wp[JB_SP])
#endif
continue; continue;
if (!bsp_match (&c, wp)) if (!bsp_match (&c, wp))