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.
This commit is contained in:
Ben Cheng 2009-12-17 12:50:58 -08:00
parent b202c54aca
commit bdcff7d66e
4 changed files with 78 additions and 2 deletions

View File

@ -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

View File

@ -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)

7
debuggerd/vfp-crasher.c Normal file
View File

@ -0,0 +1,7 @@
int main()
{
extern void crash(void);
crash();
return 0;
}

41
debuggerd/vfp.S Normal file
View File

@ -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