Loading libcorkscrew/arch-arm/backtrace-arm.c +23 −11 Original line number Original line Diff line number Diff line Loading @@ -62,21 +62,19 @@ #include <sys/exec_elf.h> #include <sys/exec_elf.h> #include <cutils/log.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. */ /* Machine context at the time a signal was raised. */ typedef struct ucontext { typedef struct ucontext { uint32_t uc_flags; uint32_t uc_flags; struct ucontext* uc_link; struct ucontext* uc_link; stack_t uc_stack; stack_t uc_stack; struct sigcontext { struct sigcontext uc_mcontext; uint32_t trap_no; uint32_t error_code; uint32_t oldmask; uint32_t gregs[16]; uint32_t arm_cpsr; uint32_t fault_address; } uc_mcontext; uint32_t uc_sigmask; uint32_t uc_sigmask; } ucontext_t; } ucontext_t; #endif /* !__BIONIC_HAVE_UCONTEXT_T */ /* Unwind state. */ /* Unwind state. */ typedef struct { typedef struct { Loading Loading @@ -560,9 +558,23 @@ ssize_t unwind_backtrace_signal_arch(siginfo_t* siginfo, void* sigcontext, const ucontext_t* uc = (const ucontext_t*)sigcontext; const ucontext_t* uc = (const ucontext_t*)sigcontext; unwind_state_t state; unwind_state_t state; for (int i = 0; i < 16; i++) { state.gregs[i] = uc->uc_mcontext.gregs[i]; state.gregs[0] = uc->uc_mcontext.arm_r0; } state.gregs[1] = uc->uc_mcontext.arm_r1; state.gregs[2] = uc->uc_mcontext.arm_r2; state.gregs[3] = uc->uc_mcontext.arm_r3; state.gregs[4] = uc->uc_mcontext.arm_r4; state.gregs[5] = uc->uc_mcontext.arm_r5; state.gregs[6] = uc->uc_mcontext.arm_r6; state.gregs[7] = uc->uc_mcontext.arm_r7; state.gregs[8] = uc->uc_mcontext.arm_r8; state.gregs[9] = uc->uc_mcontext.arm_r9; state.gregs[10] = uc->uc_mcontext.arm_r10; state.gregs[11] = uc->uc_mcontext.arm_fp; state.gregs[12] = uc->uc_mcontext.arm_ip; state.gregs[13] = uc->uc_mcontext.arm_sp; state.gregs[14] = uc->uc_mcontext.arm_lr; state.gregs[15] = uc->uc_mcontext.arm_pc; memory_t memory; memory_t memory; init_memory(&memory, map_info_list); init_memory(&memory, map_info_list); Loading libcorkscrew/arch-x86/backtrace-x86.c +23 −27 Original line number Original line Diff line number Diff line Loading @@ -34,37 +34,33 @@ #include <sys/exec_elf.h> #include <sys/exec_elf.h> #include <cutils/log.h> #include <cutils/log.h> #if !defined(__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. */ /* Machine context at the time a signal was raised. */ typedef struct ucontext { typedef struct ucontext { uint32_t uc_flags; uint32_t uc_flags; struct ucontext* uc_link; struct ucontext* uc_link; stack_t uc_stack; stack_t uc_stack; struct sigcontext { mcontext_t uc_mcontext; uint32_t gs; uint32_t fs; uint32_t es; uint32_t ds; uint32_t edi; uint32_t esi; uint32_t ebp; uint32_t esp; uint32_t ebx; uint32_t edx; uint32_t ecx; uint32_t eax; uint32_t trapno; uint32_t err; uint32_t eip; uint32_t cs; uint32_t efl; uint32_t uesp; uint32_t ss; void* fpregs; uint32_t oldmask; uint32_t cr2; } uc_mcontext; uint32_t uc_sigmask; uint32_t uc_sigmask; } ucontext_t; } ucontext_t; #endif /* !__BIONIC_HAVE_UCONTEXT_T */ /* Unwind state. */ /* Unwind state. */ typedef struct { typedef struct { Loading Loading @@ -114,9 +110,9 @@ ssize_t unwind_backtrace_signal_arch(siginfo_t* siginfo __attribute__((unused)), const ucontext_t* uc = (const ucontext_t*)sigcontext; const ucontext_t* uc = (const ucontext_t*)sigcontext; unwind_state_t state; unwind_state_t state; state.ebp = uc->uc_mcontext.ebp; state.ebp = uc->uc_mcontext.gregs[REG_EBP]; state.eip = uc->uc_mcontext.eip; state.eip = uc->uc_mcontext.gregs[REG_EIP]; state.esp = uc->uc_mcontext.esp; state.esp = uc->uc_mcontext.gregs[REG_ESP]; memory_t memory; memory_t memory; init_memory(&memory, map_info_list); init_memory(&memory, map_info_list); Loading Loading
libcorkscrew/arch-arm/backtrace-arm.c +23 −11 Original line number Original line Diff line number Diff line Loading @@ -62,21 +62,19 @@ #include <sys/exec_elf.h> #include <sys/exec_elf.h> #include <cutils/log.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. */ /* Machine context at the time a signal was raised. */ typedef struct ucontext { typedef struct ucontext { uint32_t uc_flags; uint32_t uc_flags; struct ucontext* uc_link; struct ucontext* uc_link; stack_t uc_stack; stack_t uc_stack; struct sigcontext { struct sigcontext uc_mcontext; uint32_t trap_no; uint32_t error_code; uint32_t oldmask; uint32_t gregs[16]; uint32_t arm_cpsr; uint32_t fault_address; } uc_mcontext; uint32_t uc_sigmask; uint32_t uc_sigmask; } ucontext_t; } ucontext_t; #endif /* !__BIONIC_HAVE_UCONTEXT_T */ /* Unwind state. */ /* Unwind state. */ typedef struct { typedef struct { Loading Loading @@ -560,9 +558,23 @@ ssize_t unwind_backtrace_signal_arch(siginfo_t* siginfo, void* sigcontext, const ucontext_t* uc = (const ucontext_t*)sigcontext; const ucontext_t* uc = (const ucontext_t*)sigcontext; unwind_state_t state; unwind_state_t state; for (int i = 0; i < 16; i++) { state.gregs[i] = uc->uc_mcontext.gregs[i]; state.gregs[0] = uc->uc_mcontext.arm_r0; } state.gregs[1] = uc->uc_mcontext.arm_r1; state.gregs[2] = uc->uc_mcontext.arm_r2; state.gregs[3] = uc->uc_mcontext.arm_r3; state.gregs[4] = uc->uc_mcontext.arm_r4; state.gregs[5] = uc->uc_mcontext.arm_r5; state.gregs[6] = uc->uc_mcontext.arm_r6; state.gregs[7] = uc->uc_mcontext.arm_r7; state.gregs[8] = uc->uc_mcontext.arm_r8; state.gregs[9] = uc->uc_mcontext.arm_r9; state.gregs[10] = uc->uc_mcontext.arm_r10; state.gregs[11] = uc->uc_mcontext.arm_fp; state.gregs[12] = uc->uc_mcontext.arm_ip; state.gregs[13] = uc->uc_mcontext.arm_sp; state.gregs[14] = uc->uc_mcontext.arm_lr; state.gregs[15] = uc->uc_mcontext.arm_pc; memory_t memory; memory_t memory; init_memory(&memory, map_info_list); init_memory(&memory, map_info_list); Loading
libcorkscrew/arch-x86/backtrace-x86.c +23 −27 Original line number Original line Diff line number Diff line Loading @@ -34,37 +34,33 @@ #include <sys/exec_elf.h> #include <sys/exec_elf.h> #include <cutils/log.h> #include <cutils/log.h> #if !defined(__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. */ /* Machine context at the time a signal was raised. */ typedef struct ucontext { typedef struct ucontext { uint32_t uc_flags; uint32_t uc_flags; struct ucontext* uc_link; struct ucontext* uc_link; stack_t uc_stack; stack_t uc_stack; struct sigcontext { mcontext_t uc_mcontext; uint32_t gs; uint32_t fs; uint32_t es; uint32_t ds; uint32_t edi; uint32_t esi; uint32_t ebp; uint32_t esp; uint32_t ebx; uint32_t edx; uint32_t ecx; uint32_t eax; uint32_t trapno; uint32_t err; uint32_t eip; uint32_t cs; uint32_t efl; uint32_t uesp; uint32_t ss; void* fpregs; uint32_t oldmask; uint32_t cr2; } uc_mcontext; uint32_t uc_sigmask; uint32_t uc_sigmask; } ucontext_t; } ucontext_t; #endif /* !__BIONIC_HAVE_UCONTEXT_T */ /* Unwind state. */ /* Unwind state. */ typedef struct { typedef struct { Loading Loading @@ -114,9 +110,9 @@ ssize_t unwind_backtrace_signal_arch(siginfo_t* siginfo __attribute__((unused)), const ucontext_t* uc = (const ucontext_t*)sigcontext; const ucontext_t* uc = (const ucontext_t*)sigcontext; unwind_state_t state; unwind_state_t state; state.ebp = uc->uc_mcontext.ebp; state.ebp = uc->uc_mcontext.gregs[REG_EBP]; state.eip = uc->uc_mcontext.eip; state.eip = uc->uc_mcontext.gregs[REG_EIP]; state.esp = uc->uc_mcontext.esp; state.esp = uc->uc_mcontext.gregs[REG_ESP]; memory_t memory; memory_t memory; init_memory(&memory, map_info_list); init_memory(&memory, map_info_list); Loading