Loading arch/xtensa/Kconfig.debug +8 −0 Original line number Diff line number Diff line Loading @@ -38,3 +38,11 @@ config PRINT_STACK_DEPTH help This option allows you to set the stack depth that the kernel prints in stack traces. config PRINT_USER_CODE_ON_UNHANDLED_EXCEPTION bool "Dump user code around unhandled exception address" help Enable this option to display user code around PC of the unhandled exception (starting at address aligned on 16 byte boundary). This may simplify finding faulting code in the absence of other debug facilities. arch/xtensa/kernel/traps.c +18 −0 Original line number Diff line number Diff line Loading @@ -175,6 +175,23 @@ __die_if_kernel(const char *str, struct pt_regs *regs, long err) die(str, regs, err); } #ifdef CONFIG_PRINT_USER_CODE_ON_UNHANDLED_EXCEPTION static inline void dump_user_code(struct pt_regs *regs) { char buf[32]; if (copy_from_user(buf, (void __user *)(regs->pc & -16), sizeof(buf)) == 0) { print_hex_dump(KERN_INFO, " ", DUMP_PREFIX_NONE, 32, 1, buf, sizeof(buf), false); } } #else static inline void dump_user_code(struct pt_regs *regs) { } #endif /* * Unhandled Exceptions. Kill user task or panic if in kernel space. */ Loading @@ -190,6 +207,7 @@ void do_unhandled(struct pt_regs *regs) "\tEXCCAUSE is %ld\n", current->comm, task_pid_nr(current), regs->pc, regs->exccause); dump_user_code(regs); force_sig(SIGILL); } Loading Loading
arch/xtensa/Kconfig.debug +8 −0 Original line number Diff line number Diff line Loading @@ -38,3 +38,11 @@ config PRINT_STACK_DEPTH help This option allows you to set the stack depth that the kernel prints in stack traces. config PRINT_USER_CODE_ON_UNHANDLED_EXCEPTION bool "Dump user code around unhandled exception address" help Enable this option to display user code around PC of the unhandled exception (starting at address aligned on 16 byte boundary). This may simplify finding faulting code in the absence of other debug facilities.
arch/xtensa/kernel/traps.c +18 −0 Original line number Diff line number Diff line Loading @@ -175,6 +175,23 @@ __die_if_kernel(const char *str, struct pt_regs *regs, long err) die(str, regs, err); } #ifdef CONFIG_PRINT_USER_CODE_ON_UNHANDLED_EXCEPTION static inline void dump_user_code(struct pt_regs *regs) { char buf[32]; if (copy_from_user(buf, (void __user *)(regs->pc & -16), sizeof(buf)) == 0) { print_hex_dump(KERN_INFO, " ", DUMP_PREFIX_NONE, 32, 1, buf, sizeof(buf), false); } } #else static inline void dump_user_code(struct pt_regs *regs) { } #endif /* * Unhandled Exceptions. Kill user task or panic if in kernel space. */ Loading @@ -190,6 +207,7 @@ void do_unhandled(struct pt_regs *regs) "\tEXCCAUSE is %ld\n", current->comm, task_pid_nr(current), regs->pc, regs->exccause); dump_user_code(regs); force_sig(SIGILL); } Loading