riscv: Improve __show_regs
authorKefeng Wang <wangkefeng.wang@huawei.com>
Mon, 11 Jan 2021 12:40:13 +0000 (20:40 +0800)
committerPalmer Dabbelt <palmerdabbelt@google.com>
Thu, 14 Jan 2021 23:09:12 +0000 (15:09 -0800)
Show the function symbols of epc and ra to improve the
readability of crash reports, and align the printing
formats about the raw epc value.

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
arch/riscv/kernel/process.c

index ced48d9..19f4688 100644 (file)
@@ -44,7 +44,12 @@ void __show_regs(struct pt_regs *regs)
 {
        show_regs_print_info(KERN_DEFAULT);
 
-       pr_cont("epc: " REG_FMT " ra : " REG_FMT " sp : " REG_FMT "\n",
+       if (!user_mode(regs)) {
+               pr_cont("epc : %pS\n", (void *)regs->epc);
+               pr_cont(" ra : %pS\n", (void *)regs->ra);
+       }
+
+       pr_cont("epc : " REG_FMT " ra : " REG_FMT " sp : " REG_FMT "\n",
                regs->epc, regs->ra, regs->sp);
        pr_cont(" gp : " REG_FMT " tp : " REG_FMT " t0 : " REG_FMT "\n",
                regs->gp, regs->tp, regs->t0);