diff options
| author | Jean-Baptiste Queru <jbq@google.com> | 2012-08-22 13:45:10 -0700 |
|---|---|---|
| committer | Jean-Baptiste Queru <jbq@google.com> | 2012-08-23 07:43:47 -0700 |
| commit | 5f83cf0bcf96fc58ca7314571ae264353cdee321 (patch) | |
| tree | e1f45621f2deea233d7e61b9cc1674fff242f91e /libcorkscrew/arch-x86 | |
| parent | 984d35703d5c6738253193bd53da9dedb3b58243 (diff) | |
| parent | a6405e9da2200f09c2d23270ab104ee22c25b046 (diff) | |
| download | system_core-5f83cf0bcf96fc58ca7314571ae264353cdee321.zip system_core-5f83cf0bcf96fc58ca7314571ae264353cdee321.tar.gz system_core-5f83cf0bcf96fc58ca7314571ae264353cdee321.tar.bz2 | |
resolved conflicts for merge of a6405e9d to jb-mr1-dev
Change-Id: I2c698ec017f29c9ccc89231439cb6c8013914009
Diffstat (limited to 'libcorkscrew/arch-x86')
| -rw-r--r-- | libcorkscrew/arch-x86/backtrace-x86.c | 42 |
1 files changed, 34 insertions, 8 deletions
diff --git a/libcorkscrew/arch-x86/backtrace-x86.c b/libcorkscrew/arch-x86/backtrace-x86.c index 6cdb0c8..fb79a0c 100644 --- a/libcorkscrew/arch-x86/backtrace-x86.c +++ b/libcorkscrew/arch-x86/backtrace-x86.c @@ -35,18 +35,50 @@ #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 +#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 */ + +#else /* __BIONIC__ */ // glibc has its own renaming of the Linux kernel's structures. #define __USE_GNU // For REG_EBP, REG_ESP, and REG_EIP. #include <ucontext.h> -#endif +#endif /* __ BIONIC__ */ /* Unwind state. */ typedef struct { @@ -96,15 +128,9 @@ ssize_t unwind_backtrace_signal_arch(siginfo_t* siginfo __attribute__((unused)), const ucontext_t* uc = (const ucontext_t*)sigcontext; unwind_state_t state; -#if defined(__BIONIC__) - state.ebp = uc->uc_mcontext.ebp; - state.esp = uc->uc_mcontext.esp; - state.eip = uc->uc_mcontext.eip; -#else state.ebp = uc->uc_mcontext.gregs[REG_EBP]; state.esp = uc->uc_mcontext.gregs[REG_ESP]; state.eip = uc->uc_mcontext.gregs[REG_EIP]; -#endif memory_t memory; init_memory(&memory, map_info_list); |
