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

Rework 69001646fa, store sigframe address into sigcontext_addr.

This commit is contained in:
Konstantin Belousov 2010-04-11 22:01:08 +03:00
parent 42bc15c72c
commit 21f0e90ce8
2 changed files with 5 additions and 4 deletions

View file

@ -28,6 +28,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#include <sys/types.h>
#include <signal.h>
#include <stddef.h>
#include <ucontext.h>
#include <machine/sigframe.h>
@ -108,7 +109,7 @@ unw_handle_signal_frame (unw_cursor_t *cursor)
sf = (struct sigframe *)c->dwarf.cfa;
uc_addr = (uintptr_t)&(sf->sf_uc);
c->uc = (ucontext_t *)uc_addr;
c->sigcontext_addr = c->dwarf.cfa;
esp_loc = DWARF_LOC (uc_addr + FREEBSD_UC_MCONTEXT_ESP_OFF, 0);
ret = dwarf_get (&c->dwarf, esp_loc, &c->dwarf.cfa);
@ -150,7 +151,7 @@ x86_get_scratch_loc (struct cursor *c, unw_regnum_t reg)
return DWARF_REG_LOC (&c->dwarf, reg);
case X86_SCF_FREEBSD_SIGFRAME:
addr += FREEBSD_UC_MCONTEXT_OFF;
addr += offsetof(struct sigframe, sf_uc) + FREEBSD_UC_MCONTEXT_OFF;
break;
case X86_SCF_FREEBSD_SIGFRAME4:

View file

@ -96,7 +96,7 @@ unw_handle_signal_frame (unw_cursor_t *cursor)
if (c->sigcontext_format == X86_64_SCF_FREEBSD_SIGFRAME)
{
ucontext = c->dwarf.cfa + offsetof(struct sigframe, sf_uc);
c->uc = (ucontext_t *)ucontext;
c->sigcontext_addr = c->dwarf.cfa;
Debug(1, "signal frame, skip over trampoline\n");
struct dwarf_loc rsp_loc = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_RSP, 0);
@ -186,7 +186,7 @@ HIDDEN NORETURN void
x86_64_sigreturn (unw_cursor_t *cursor)
{
struct cursor *c = (struct cursor *) cursor;
ucontext_t *uc = c->uc;
ucontext_t *uc = c->dwarf.cfa + offsetof(struct sigframe, sf_uc);
Debug (8, "resuming at ip=%llx via sigreturn(%p)\n",
(unsigned long long) c->dwarf.ip, uc);