Index: sys/riscv/riscv/db_trace.c =================================================================== --- sys/riscv/riscv/db_trace.c +++ sys/riscv/riscv/db_trace.c @@ -129,15 +129,12 @@ struct unwind_state frame; struct pcb *ctx; - if (thr != curthread) { - ctx = kdb_thr_ctx(thr); + ctx = kdb_thr_ctx(thr); - frame.sp = (uint64_t)ctx->pcb_sp; - frame.fp = (uint64_t)ctx->pcb_s[0]; - frame.pc = (uint64_t)ctx->pcb_ra; - db_stack_trace_cmd(&frame); - } else - db_trace_self(); + frame.sp = (uint64_t)ctx->pcb_sp; + frame.fp = (uint64_t)ctx->pcb_s[0]; + frame.pc = (uint64_t)ctx->pcb_ra; + db_stack_trace_cmd(&frame); return (0); } Index: sys/riscv/riscv/machdep.c =================================================================== --- sys/riscv/riscv/machdep.c +++ sys/riscv/riscv/machdep.c @@ -571,7 +571,7 @@ memcpy(pcb->pcb_s, tf->tf_s, sizeof(tf->tf_s)); - pcb->pcb_ra = tf->tf_ra; + pcb->pcb_ra = tf->tf_sepc; pcb->pcb_sp = tf->tf_sp; pcb->pcb_gp = tf->tf_gp; pcb->pcb_tp = tf->tf_tp;