From 85946d97660a79d9943d11edfe616ae68cf9d261 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Sat, 28 Jun 2014 23:28:08 +0300 Subject: [PATCH] Use helper to walk past the syscall frames on FreeBSD/x86, similar to FreeBSD/x86_64. The syscall trampolines in FreeBSD libc do not have unwind annotations. --- src/x86/Gos-freebsd.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/x86/Gos-freebsd.c b/src/x86/Gos-freebsd.c index 247c35fa..aafdfc9c 100644 --- a/src/x86/Gos-freebsd.c +++ b/src/x86/Gos-freebsd.c @@ -91,6 +91,11 @@ XXX w3 == 0x14688e03 && w4 == 0x0001a1b8 && w5 == 0x80cd5000) ret = X86_SCF_FREEBSD_SIGFRAME; } + + /* Check for syscall */ + if (ret == X86_SCF_NONE && (*a->access_mem) (as, ip - 2, &w0, 0, arg) >= 0 && + (w0 & 0xffff) == 0x80cd) + ret = X86_SCF_FREEBSD_SYSCALL; Debug (16, "returning %d\n", ret); c->sigcontext_format = ret; return (ret); @@ -131,6 +136,10 @@ unw_handle_signal_frame (unw_cursor_t *cursor) c->dwarf.loc[EFLAGS] = DWARF_LOC (uc_addr + FREEBSD_UC_MCONTEXT_EFLAGS_OFF, 0); c->dwarf.loc[TRAPNO] = DWARF_LOC (uc_addr + FREEBSD_UC_MCONTEXT_TRAPNO_OFF, 0); c->dwarf.loc[ST0] = DWARF_NULL_LOC; + } else if (c->sigcontext_format == X86_SCF_FREEBSD_SYSCALL) { + c->dwarf.loc[EIP] = DWARF_LOC (c->dwarf.cfa, 0); + c->dwarf.loc[EAX] = DWARF_NULL_LOC; + c->dwarf.cfa += 4; } else { Debug (8, "Gstep: not handling frame format %d\n", c->sigcontext_format); abort();