diff options
Diffstat (limited to 'libcorkscrew')
-rw-r--r-- | libcorkscrew/Android.mk | 8 | ||||
-rw-r--r-- | libcorkscrew/arch-arm/backtrace-arm.c | 14 | ||||
-rw-r--r-- | libcorkscrew/arch-mips/backtrace-mips.c | 45 | ||||
-rwxr-xr-x | libcorkscrew/arch-x86/backtrace-x86.c | 41 |
4 files changed, 12 insertions, 96 deletions
diff --git a/libcorkscrew/Android.mk b/libcorkscrew/Android.mk index e275317..8f3b68c 100644 --- a/libcorkscrew/Android.mk +++ b/libcorkscrew/Android.mk @@ -30,6 +30,8 @@ x86_src_files := \ arch-x86/backtrace-x86.c \ arch-x86/ptrace-x86.c +ifneq ($(TARGET_IS_64_BIT),true) + include $(CLEAR_VARS) LOCAL_SRC_FILES := $(generic_src_files) @@ -66,9 +68,9 @@ LOCAL_MODULE := libcorkscrew_test LOCAL_MODULE_TAGS := optional include $(BUILD_EXECUTABLE) +endif # TARGET_IS_64_BIT == false + -# TODO: reenable darwin-x86 -# ifeq ($(HOST_ARCH),x86) ifeq ($(HOST_OS)-$(HOST_ARCH),linux-x86) # Build libcorkscrew. @@ -95,4 +97,4 @@ LOCAL_MODULE := libcorkscrew_test LOCAL_MODULE_TAGS := optional include $(BUILD_HOST_EXECUTABLE) -endif # HOST_ARCH == x86 +endif # $(HOST_OS)-$(HOST_ARCH) == linux-x86 diff --git a/libcorkscrew/arch-arm/backtrace-arm.c b/libcorkscrew/arch-arm/backtrace-arm.c index 7bd0d8f..751efbf 100644 --- a/libcorkscrew/arch-arm/backtrace-arm.c +++ b/libcorkscrew/arch-arm/backtrace-arm.c @@ -62,19 +62,7 @@ #include <elf.h> #include <cutils/log.h> -#if !defined(__BIONIC_HAVE_UCONTEXT_T) -/* Old versions of the Android <signal.h> didn't define ucontext_t. */ -#include <asm/sigcontext.h> /* Ensure 'struct sigcontext' is defined. */ - -/* Machine context at the time a signal was raised. */ -typedef struct ucontext { - uint32_t uc_flags; - struct ucontext* uc_link; - stack_t uc_stack; - struct sigcontext uc_mcontext; - uint32_t uc_sigmask; -} ucontext_t; -#endif /* !__BIONIC_HAVE_UCONTEXT_T */ +#include <ucontext.h> /* Unwind state. */ typedef struct { diff --git a/libcorkscrew/arch-mips/backtrace-mips.c b/libcorkscrew/arch-mips/backtrace-mips.c index 57cb324..832fb86 100644 --- a/libcorkscrew/arch-mips/backtrace-mips.c +++ b/libcorkscrew/arch-mips/backtrace-mips.c @@ -36,18 +36,7 @@ #include <sys/ptrace.h> #include <cutils/log.h> -#if defined(__BIONIC__) - -#if defined(__BIONIC_HAVE_UCONTEXT_T) - -// Bionic offers the Linux kernel headers. -#include <asm/sigcontext.h> -#include <asm/ucontext.h> -typedef struct ucontext ucontext_t; - -#else /* __BIONIC_HAVE_UCONTEXT_T */ - -/* Old versions of the Android <signal.h> didn't define ucontext_t. */ +#include <sys/ucontext.h> /* For PTRACE_GETREGS */ typedef struct { @@ -71,30 +60,6 @@ enum { REG_GP, REG_SP, REG_S8, REG_RA, }; -/* Machine context at the time a signal was raised. */ -typedef struct ucontext { - unsigned int sc_regmask; - unsigned int sc_status; - unsigned long long sc_pc; - unsigned long long sc_regs[32]; - unsigned long long sc_fpregs[32]; - unsigned int sc_acx; - unsigned int sc_fpc_csr; - unsigned int sc_fpc_eir; - unsigned int sc_used_math; - unsigned int sc_dsp; - unsigned long long sc_mdhi; - unsigned long long sc_mdlo; - unsigned long sc_hi1; - unsigned long sc_lo1; - unsigned long sc_hi2; - unsigned long sc_lo2; - unsigned long sc_hi3; - unsigned long sc_lo3; -} ucontext_t; - -#endif /* __BIONIC_HAVE_UCONTEXT_T */ -#endif /* Unwind state. */ typedef struct { @@ -896,10 +861,10 @@ ssize_t unwind_backtrace_signal_arch(siginfo_t* siginfo __attribute__((unused)), const ucontext_t* uc = (const ucontext_t*)sigcontext; unwind_state_t state; - state.reg[DWARF_PC] = uc->sc_pc; - state.reg[DWARF_RA] = uc->sc_regs[REG_RA]; - state.reg[DWARF_FP] = uc->sc_regs[REG_S8]; - state.reg[DWARF_SP] = uc->sc_regs[REG_SP]; + state.reg[DWARF_PC] = uc->uc_mcontext.pc; + state.reg[DWARF_RA] = uc->uc_mcontext.gregs[REG_RA]; + state.reg[DWARF_FP] = uc->uc_mcontext.gregs[REG_S8]; + state.reg[DWARF_SP] = uc->uc_mcontext.gregs[REG_SP]; ALOGV("unwind_backtrace_signal_arch: " "ignore_depth=%d max_depth=%d pc=0x%08x sp=0x%08x ra=0x%08x\n", diff --git a/libcorkscrew/arch-x86/backtrace-x86.c b/libcorkscrew/arch-x86/backtrace-x86.c index ef22821..df486de 100755 --- a/libcorkscrew/arch-x86/backtrace-x86.c +++ b/libcorkscrew/arch-x86/backtrace-x86.c @@ -36,46 +36,7 @@ #include <sys/ptrace.h> #include <cutils/log.h> -#if defined(__BIONIC__) - -#if defined(__BIONIC_HAVE_UCONTEXT_T) - -// Bionic offers the Linux kernel headers. -#include <asm/sigcontext.h> -#include <asm/ucontext.h> -typedef struct ucontext ucontext_t; - -#else /* __BIONIC_HAVE_UCONTEXT_T */ - -/* Old versions of the Android <signal.h> didn't define ucontext_t. */ - -typedef struct { - uint32_t gregs[32]; - void* fpregs; - uint32_t oldmask; - uint32_t cr2; -} mcontext_t; - -enum { - REG_GS = 0, REG_FS, REG_ES, REG_DS, - REG_EDI, REG_ESI, REG_EBP, REG_ESP, - REG_EBX, REG_EDX, REG_ECX, REG_EAX, - REG_TRAPNO, REG_ERR, REG_EIP, REG_CS, - REG_EFL, REG_UESP, REG_SS -}; - -/* Machine context at the time a signal was raised. */ -typedef struct ucontext { - uint32_t uc_flags; - struct ucontext* uc_link; - stack_t uc_stack; - mcontext_t uc_mcontext; - uint32_t uc_sigmask; -} ucontext_t; - -#endif /* __BIONIC_HAVE_UCONTEXT_T */ - -#elif defined(__APPLE__) +#if defined(__APPLE__) #define _XOPEN_SOURCE #include <ucontext.h> |