mirror of
https://github.com/tobast/libunwind-eh_elf.git
synced 2024-11-26 09:07:38 +01:00
More move of osdep code.
This commit is contained in:
parent
a40641f326
commit
ccc0ae665b
2 changed files with 50 additions and 47 deletions
|
@ -94,10 +94,8 @@ unw_handle_signal_frame (unw_cursor_t *cursor)
|
|||
int ret;
|
||||
|
||||
if (c->sigcontext_format == X86_64_SCF_FREEBSD_SIGFRAME)
|
||||
{
|
||||
ucontext = c->dwarf.cfa + offsetof(struct sigframe, sf_uc);
|
||||
else
|
||||
return -UNW_EBADFRAME;
|
||||
|
||||
Debug(1, "signal frame, skip over trampoline\n");
|
||||
|
||||
struct dwarf_loc rsp_loc = DWARF_LOC (ucontext + UC_MCONTEXT_GREGS_RSP, 0);
|
||||
|
@ -128,3 +126,25 @@ unw_handle_signal_frame (unw_cursor_t *cursor)
|
|||
|
||||
return 0;
|
||||
}
|
||||
else if (c->sigcontext_format == X86_64_SCF_FREEBSD_SYSCALL)
|
||||
{
|
||||
c->dwarf.loc[RCX] = c->dwarf.loc[R10];
|
||||
/* rsp_loc = DWARF_LOC(c->dwarf.cfa - 8, 0); */
|
||||
/* rbp_loc = c->dwarf.loc[RBP]; */
|
||||
c->dwarf.loc[RIP] = DWARF_LOC (c->dwarf.cfa, 0);
|
||||
ret = dwarf_get (&c->dwarf, c->dwarf.loc[RIP], &c->dwarf.ip);
|
||||
Debug (1, "Frame Chain [RIP=0x%Lx] = 0x%Lx\n",
|
||||
(unsigned long long) DWARF_GET_LOC (c->dwarf.loc[RIP]),
|
||||
(unsigned long long) c->dwarf.ip);
|
||||
if (ret < 0)
|
||||
{
|
||||
Debug (2, "returning %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
c->dwarf.cfa += 8;
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
return -UNW_EBADFRAME;
|
||||
|
||||
}
|
||||
|
|
|
@ -77,24 +77,7 @@ unw_step (unw_cursor_t *cursor)
|
|||
|
||||
Debug (13, "dwarf_step() failed (ret=%d), trying frame-chain\n", ret);
|
||||
|
||||
c->sigcontext_format = unw_is_signal_frame (cursor);
|
||||
if (c->sigcontext_format == X86_64_SCF_FREEBSD_SYSCALL) {
|
||||
c->dwarf.loc[RCX] = c->dwarf.loc[R10];
|
||||
// rsp_loc = DWARF_LOC(c->dwarf.cfa - 8, 0);
|
||||
// rbp_loc = c->dwarf.loc[RBP];
|
||||
c->dwarf.loc[RIP] = DWARF_LOC (c->dwarf.cfa, 0);
|
||||
ret = dwarf_get (&c->dwarf, c->dwarf.loc[RIP], &c->dwarf.ip);
|
||||
Debug (1, "Frame Chain [RIP=0x%Lx] = 0x%Lx\n",
|
||||
(unsigned long long) DWARF_GET_LOC (c->dwarf.loc[RIP]),
|
||||
(unsigned long long) c->dwarf.ip);
|
||||
if (ret < 0)
|
||||
{
|
||||
Debug (2, "returning %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
c->dwarf.cfa += 8;
|
||||
return 1;
|
||||
} else if (c->sigcontext_format != X86_64_SCF_NONE)
|
||||
if (unw_is_signal_frame (cursor))
|
||||
{
|
||||
ret = unw_handle_signal_frame(cursor);
|
||||
if (ret < 0)
|
||||
|
|
Loading…
Reference in a new issue