mirror of
https://github.com/tobast/libunwind-eh_elf.git
synced 2024-11-30 02:27:38 +01:00
Code for resume
This commit is contained in:
parent
c64723835c
commit
53095e6b3e
4 changed files with 12 additions and 11 deletions
|
@ -244,7 +244,7 @@ libunwind_x86_la_SOURCES_x86 = $(libunwind_la_SOURCES_x86_common) \
|
||||||
# The list of files that go both into libunwind and libunwind-x86_64:
|
# The list of files that go both into libunwind and libunwind-x86_64:
|
||||||
libunwind_la_SOURCES_x86_64_common = $(libunwind_la_SOURCES_common) \
|
libunwind_la_SOURCES_x86_64_common = $(libunwind_la_SOURCES_common) \
|
||||||
$(dwarf_SOURCES_common) \
|
$(dwarf_SOURCES_common) \
|
||||||
elf64.c elf64.h \
|
elf64.c elf64.h x86_64/offsets.h \
|
||||||
x86_64/init.h x86_64/unwind_i.h x86_64/ucontext_i.h \
|
x86_64/init.h x86_64/unwind_i.h x86_64/ucontext_i.h \
|
||||||
x86_64/is_fpreg.c x86_64/regname.c
|
x86_64/is_fpreg.c x86_64/regname.c
|
||||||
|
|
||||||
|
|
|
@ -82,6 +82,3 @@
|
||||||
#define LINUX_FPSTATE_XMM5_OFF 0x160
|
#define LINUX_FPSTATE_XMM5_OFF 0x160
|
||||||
#define LINUX_FPSTATE_XMM6_OFF 0x170
|
#define LINUX_FPSTATE_XMM6_OFF 0x170
|
||||||
#define LINUX_FPSTATE_XMM7_OFF 0x180
|
#define LINUX_FPSTATE_XMM7_OFF 0x180
|
||||||
|
|
||||||
/* FreeBSD specific definitions */
|
|
||||||
#define FREEBSD_UC_MCONTEXT_OFF 0x10
|
|
||||||
|
|
|
@ -27,13 +27,14 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "offsets.h"
|
||||||
#include "unwind_i.h"
|
#include "unwind_i.h"
|
||||||
|
|
||||||
#ifndef UNW_REMOTE_ONLY
|
#ifndef UNW_REMOTE_ONLY
|
||||||
|
|
||||||
#include <sys/syscall.h>
|
#include <sys/syscall.h>
|
||||||
|
|
||||||
#if defined(__linux)
|
#if defined __linux
|
||||||
/* sigreturn() is a no-op on x86_64 glibc. */
|
/* sigreturn() is a no-op on x86_64 glibc. */
|
||||||
|
|
||||||
static NORETURN inline long
|
static NORETURN inline long
|
||||||
|
@ -51,7 +52,6 @@ my_rt_sigreturn (void *new_sp)
|
||||||
HIDDEN inline int
|
HIDDEN inline int
|
||||||
x86_64_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg)
|
x86_64_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg)
|
||||||
{
|
{
|
||||||
#if defined(__linux)
|
|
||||||
struct cursor *c = (struct cursor *) cursor;
|
struct cursor *c = (struct cursor *) cursor;
|
||||||
ucontext_t *uc = c->uc;
|
ucontext_t *uc = c->uc;
|
||||||
|
|
||||||
|
@ -67,7 +67,13 @@ x86_64_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg)
|
||||||
|
|
||||||
Debug (8, "resuming at ip=%llx via sigreturn(%p)\n",
|
Debug (8, "resuming at ip=%llx via sigreturn(%p)\n",
|
||||||
(unsigned long long) c->dwarf.ip, sc);
|
(unsigned long long) c->dwarf.ip, sc);
|
||||||
|
#if defined __linux__
|
||||||
my_rt_sigreturn (sc);
|
my_rt_sigreturn (sc);
|
||||||
|
#elif defined __FreeBSD__
|
||||||
|
sigreturn((char *)(c->uc) - FREEBSD_UC_MCONTEXT_OFF);
|
||||||
|
#else
|
||||||
|
#error Port me
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -75,11 +81,6 @@ x86_64_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg)
|
||||||
(unsigned long long) c->dwarf.ip);
|
(unsigned long long) c->dwarf.ip);
|
||||||
setcontext (uc);
|
setcontext (uc);
|
||||||
}
|
}
|
||||||
#elif defined(__FreeBSD__)
|
|
||||||
/* XXXKIB */
|
|
||||||
#else
|
|
||||||
# warning Implement me!
|
|
||||||
#endif
|
|
||||||
return -UNW_EINVAL;
|
return -UNW_EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
3
src/x86_64/offsets.h
Normal file
3
src/x86_64/offsets.h
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
/* FreeBSD specific definitions */
|
||||||
|
|
||||||
|
#define FREEBSD_UC_MCONTEXT_OFF 0x10
|
Loading…
Reference in a new issue