Skip to content

Commit

Permalink
riscv: Improve __show_regs
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Kefeng Wang authored and Palmer Dabbelt committed Jan 14, 2021
1 parent 091b945 commit da401e8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion arch/riscv/kernel/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit da401e8

Please sign in to comment.