debug, dump registers on arm too.
This commit is contained in:
parent
13707f988b
commit
6548157293
82
src/debug.c
82
src/debug.c
@ -1045,6 +1045,61 @@ void logRegisters(ucontext_t *uc) {
|
|||||||
(unsigned long) uc->uc_mcontext.gregs[18]
|
(unsigned long) uc->uc_mcontext.gregs[18]
|
||||||
);
|
);
|
||||||
logStackContent((void**)uc->uc_mcontext.gregs[15]);
|
logStackContent((void**)uc->uc_mcontext.gregs[15]);
|
||||||
|
#elif defined(__aarch64__) /* Linux AArch64 */
|
||||||
|
serverLog(LL_WARNING,
|
||||||
|
"\n"
|
||||||
|
"X18:%016lx X19:%016lx\nX20:%016lx X21:%016lx\n"
|
||||||
|
"X22:%016lx X23:%016lx\nX24:%016lx X25:%016lx\n"
|
||||||
|
"X26:%016lx X27:%016lx\nX28:%016lx X29:%016lx\n"
|
||||||
|
"X30:%016lx\n"
|
||||||
|
"pc:%016lx sp:%016lx\npstate:%016lx fault_address:%016lx\n",
|
||||||
|
(unsigned long) uc->uc_mcontext.regs[18],
|
||||||
|
(unsigned long) uc->uc_mcontext.regs[19],
|
||||||
|
(unsigned long) uc->uc_mcontext.regs[20],
|
||||||
|
(unsigned long) uc->uc_mcontext.regs[21],
|
||||||
|
(unsigned long) uc->uc_mcontext.regs[22],
|
||||||
|
(unsigned long) uc->uc_mcontext.regs[23],
|
||||||
|
(unsigned long) uc->uc_mcontext.regs[24],
|
||||||
|
(unsigned long) uc->uc_mcontext.regs[25],
|
||||||
|
(unsigned long) uc->uc_mcontext.regs[26],
|
||||||
|
(unsigned long) uc->uc_mcontext.regs[27],
|
||||||
|
(unsigned long) uc->uc_mcontext.regs[28],
|
||||||
|
(unsigned long) uc->uc_mcontext.regs[29],
|
||||||
|
(unsigned long) uc->uc_mcontext.regs[30],
|
||||||
|
(unsigned long) uc->uc_mcontext.pc,
|
||||||
|
(unsigned long) uc->uc_mcontext.sp,
|
||||||
|
(unsigned long) uc->uc_mcontext.pstate,
|
||||||
|
(unsigned long) uc->uc_mcontext.fault_address
|
||||||
|
);
|
||||||
|
logStackContent((void**)uc->uc_mcontext.sp);
|
||||||
|
#elif defined(__arm__) /* Linux ARM */
|
||||||
|
serverLog(LL_WARNING,
|
||||||
|
"\n"
|
||||||
|
"R10:%016lx R9 :%016lx\nR8 :%016lx R7 :%016lx\n"
|
||||||
|
"R6 :%016lx R5 :%016lx\nR4 :%016lx R3 :%016lx\n"
|
||||||
|
"R2 :%016lx R1 :%016lx\nR0 :%016lx EC :%016lx\n"
|
||||||
|
"fp: %016lx ip:%016lx\n",
|
||||||
|
"pc:%016lx sp:%016lx\ncpsr:%016lx fault_address:%016lx\n",
|
||||||
|
(unsigned long) uc->uc_mcontext.arm_r10,
|
||||||
|
(unsigned long) uc->uc_mcontext.arm_r9,
|
||||||
|
(unsigned long) uc->uc_mcontext.arm_r8,
|
||||||
|
(unsigned long) uc->uc_mcontext.arm_r7,
|
||||||
|
(unsigned long) uc->uc_mcontext.arm_r6,
|
||||||
|
(unsigned long) uc->uc_mcontext.arm_r5,
|
||||||
|
(unsigned long) uc->uc_mcontext.arm_r4,
|
||||||
|
(unsigned long) uc->uc_mcontext.arm_r3,
|
||||||
|
(unsigned long) uc->uc_mcontext.arm_r2,
|
||||||
|
(unsigned long) uc->uc_mcontext.arm_r1,
|
||||||
|
(unsigned long) uc->uc_mcontext.arm_r0,
|
||||||
|
(unsigned long) uc->uc_mcontext.error_code,
|
||||||
|
(unsigned long) uc->uc_mcontext.arm_fp,
|
||||||
|
(unsigned long) uc->uc_mcontext.arm_ip,
|
||||||
|
(unsigned long) uc->uc_mcontext.arm_pc,
|
||||||
|
(unsigned long) uc->uc_mcontext.arm_sp,
|
||||||
|
(unsigned long) uc->uc_mcontext.arm_cpsr,
|
||||||
|
(unsigned long) uc->uc_mcontext.fault_address
|
||||||
|
);
|
||||||
|
logStackContent((void**)uc->uc_mcontext.arm_sp);
|
||||||
#endif
|
#endif
|
||||||
#elif defined(__FreeBSD__)
|
#elif defined(__FreeBSD__)
|
||||||
#if defined(__x86_64__)
|
#if defined(__x86_64__)
|
||||||
@ -1185,33 +1240,6 @@ void logRegisters(ucontext_t *uc) {
|
|||||||
(unsigned long) uc->uc_mcontext.mc_cs
|
(unsigned long) uc->uc_mcontext.mc_cs
|
||||||
);
|
);
|
||||||
logStackContent((void**)uc->uc_mcontext.mc_rsp);
|
logStackContent((void**)uc->uc_mcontext.mc_rsp);
|
||||||
#elif defined(__aarch64__) /* Linux AArch64 */
|
|
||||||
serverLog(LL_WARNING,
|
|
||||||
"\n"
|
|
||||||
"X18:%016lx X19:%016lx\nX20:%016lx X21:%016lx\n"
|
|
||||||
"X22:%016lx X23:%016lx\nX24:%016lx X25:%016lx\n"
|
|
||||||
"X26:%016lx X27:%016lx\nX28:%016lx X29:%016lx\n"
|
|
||||||
"X30:%016lx\n"
|
|
||||||
"pc:%016lx sp:%016lx\npstate:%016lx fault_address:%016lx\n",
|
|
||||||
(unsigned long) uc->uc_mcontext.regs[18],
|
|
||||||
(unsigned long) uc->uc_mcontext.regs[19],
|
|
||||||
(unsigned long) uc->uc_mcontext.regs[20],
|
|
||||||
(unsigned long) uc->uc_mcontext.regs[21],
|
|
||||||
(unsigned long) uc->uc_mcontext.regs[22],
|
|
||||||
(unsigned long) uc->uc_mcontext.regs[23],
|
|
||||||
(unsigned long) uc->uc_mcontext.regs[24],
|
|
||||||
(unsigned long) uc->uc_mcontext.regs[25],
|
|
||||||
(unsigned long) uc->uc_mcontext.regs[26],
|
|
||||||
(unsigned long) uc->uc_mcontext.regs[27],
|
|
||||||
(unsigned long) uc->uc_mcontext.regs[28],
|
|
||||||
(unsigned long) uc->uc_mcontext.regs[29],
|
|
||||||
(unsigned long) uc->uc_mcontext.regs[30],
|
|
||||||
(unsigned long) uc->uc_mcontext.pc,
|
|
||||||
(unsigned long) uc->uc_mcontext.sp,
|
|
||||||
(unsigned long) uc->uc_mcontext.pstate,
|
|
||||||
(unsigned long) uc->uc_mcontext.fault_address
|
|
||||||
);
|
|
||||||
logStackContent((void**)uc->uc_mcontext.sp);
|
|
||||||
#else
|
#else
|
||||||
serverLog(LL_WARNING,
|
serverLog(LL_WARNING,
|
||||||
" Dumping of registers not supported for this OS/arch");
|
" Dumping of registers not supported for this OS/arch");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user