diff options
author | Ben Cheng <bccheng@google.com> | 2009-12-17 12:50:58 -0800 |
---|---|---|
committer | Ben Cheng <bccheng@google.com> | 2009-12-17 12:53:06 -0800 |
commit | bdcff7d66ef8f6602e017d03cf4ffa57bac39b92 (patch) | |
tree | bb14c4e3fb025e293da1c613467a4472e2a6879d /debuggerd | |
parent | b202c54aca4d84086a4dcc0f3c0bbc02d1dd9625 (diff) | |
download | system_core-bdcff7d66ef8f6602e017d03cf4ffa57bac39b92.tar.gz system_core-bdcff7d66ef8f6602e017d03cf4ffa57bac39b92.tar.bz2 system_core-bdcff7d66ef8f6602e017d03cf4ffa57bac39b92.zip |
Dump VFP registers and status word when native app crashes.
Bug: 2226399
Caveat: d0/d1 appear to be clobbered by ptrace. It will be tracked by a new bug.
Diffstat (limited to 'debuggerd')
-rw-r--r-- | debuggerd/Android.mk | 14 | ||||
-rw-r--r-- | debuggerd/debuggerd.c | 18 | ||||
-rw-r--r-- | debuggerd/vfp-crasher.c | 7 | ||||
-rw-r--r-- | debuggerd/vfp.S | 41 |
4 files changed, 78 insertions, 2 deletions
diff --git a/debuggerd/Android.mk b/debuggerd/Android.mk index b22e1a81..b86f2a57 100644 --- a/debuggerd/Android.mk +++ b/debuggerd/Android.mk @@ -14,13 +14,23 @@ LOCAL_STATIC_LIBRARIES := libcutils libc include $(BUILD_EXECUTABLE) include $(CLEAR_VARS) -LOCAL_SRC_FILES := crasher.c +LOCAL_SRC_FILES := crasher.c LOCAL_SRC_FILES += crashglue.S -LOCAL_MODULE := crasher +LOCAL_MODULE := crasher LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) LOCAL_MODULE_TAGS := eng #LOCAL_FORCE_STATIC_EXECUTABLE := true LOCAL_SHARED_LIBRARIES := libcutils libc include $(BUILD_EXECUTABLE) +ifeq ($(TARGET_ARCH_VARIANT),armv7-a) +include $(CLEAR_VARS) +LOCAL_SRC_FILES := vfp-crasher.c vfp.S +LOCAL_MODULE := vfp-crasher +LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) +LOCAL_MODULE_TAGS := eng +LOCAL_SHARED_LIBRARIES := libcutils libc +include $(BUILD_EXECUTABLE) +endif # TARGET_ARCH_VARIANT == armv7-a + endif # TARGET_ARCH == arm diff --git a/debuggerd/debuggerd.c b/debuggerd/debuggerd.c index 145135fc..3757cd5f 100644 --- a/debuggerd/debuggerd.c +++ b/debuggerd/debuggerd.c @@ -285,6 +285,24 @@ void dump_registers(int tfd, int pid, bool at_fault) _LOG(tfd, only_in_tombstone, " ip %08x sp %08x lr %08x pc %08x cpsr %08x\n", r.ARM_ip, r.ARM_sp, r.ARM_lr, r.ARM_pc, r.ARM_cpsr); + +#if __VFP_FP__ + struct user_vfp vfp_regs; + int i; + + if(ptrace(PTRACE_GETVFPREGS, pid, 0, &vfp_regs)) { + _LOG(tfd, only_in_tombstone, + "cannot get registers: %s\n", strerror(errno)); + return; + } + + for (i = 0; i < 32; i += 2) { + _LOG(tfd, only_in_tombstone, + " d%-2d %016llx d%-2d %016llx\n", + i, vfp_regs.fpregs[i], i+1, vfp_regs.fpregs[i+1]); + } + _LOG(tfd, only_in_tombstone, " scr %08lx\n\n", vfp_regs.fpscr); +#endif } const char *get_signame(int sig) diff --git a/debuggerd/vfp-crasher.c b/debuggerd/vfp-crasher.c new file mode 100644 index 00000000..7a19cdd8 --- /dev/null +++ b/debuggerd/vfp-crasher.c @@ -0,0 +1,7 @@ +int main() +{ + extern void crash(void); + + crash(); + return 0; +} diff --git a/debuggerd/vfp.S b/debuggerd/vfp.S new file mode 100644 index 00000000..21924152 --- /dev/null +++ b/debuggerd/vfp.S @@ -0,0 +1,41 @@ + .text + .align 2 + .global crash + .type crash, %function +crash: + fconstd d0, #0 + fconstd d1, #1 + fconstd d2, #2 + fconstd d3, #3 + fconstd d4, #4 + fconstd d5, #5 + fconstd d6, #6 + fconstd d7, #7 + fconstd d8, #8 + fconstd d9, #9 + fconstd d10, #10 + fconstd d11, #11 + fconstd d12, #12 + fconstd d13, #13 + fconstd d14, #14 + fconstd d15, #15 + fconstd d16, #16 + fconstd d17, #17 + fconstd d18, #18 + fconstd d19, #19 + fconstd d20, #20 + fconstd d21, #21 + fconstd d22, #22 + fconstd d23, #23 + fconstd d24, #24 + fconstd d25, #25 + fconstd d26, #26 + fconstd d27, #27 + fconstd d28, #28 + fconstd d29, #29 + fconstd d30, #30 + fconstd d31, #31 + mov r0, #0 + str r0, [r0] + bx lr + |