git: e14f67dfed07 - stable/13 - riscv: decode syscall in ddb backtrace

From: Mitchell Horne <mhorne_at_FreeBSD.org>
Date: Sun, 06 Nov 2022 14:55:38 UTC
The branch stable/13 has been updated by mhorne:

URL: https://cgit.FreeBSD.org/src/commit/?id=e14f67dfed07bf57978a55f78cc19f565fe1086e

commit e14f67dfed07bf57978a55f78cc19f565fe1086e
Author:     Mitchell Horne <mhorne@FreeBSD.org>
AuthorDate: 2022-10-02 22:47:24 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2022-11-06 14:54:46 +0000

    riscv: decode syscall in ddb backtrace
    
    This presents the existing information in a slightly more readable way.
    
    Reviewed by:    jrtc27, markj, jhb
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D36565
    
    (cherry picked from commit 791bfa60e8ac85381d449bae5caa0999950a7039)
---
 sys/riscv/riscv/db_trace.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/sys/riscv/riscv/db_trace.c b/sys/riscv/riscv/db_trace.c
index 56508464e7c6..ef8698917021 100644
--- a/sys/riscv/riscv/db_trace.c
+++ b/sys/riscv/riscv/db_trace.c
@@ -92,13 +92,18 @@ db_stack_trace_cmd(struct thread *td, struct unwind_state *frame)
 				break;
 			}
 
-			if ((tf->tf_scause & SCAUSE_INTR) != 0)
+			if ((tf->tf_scause & SCAUSE_INTR) != 0) {
 				db_printf("--- interrupt %ld\n",
 				    tf->tf_scause & SCAUSE_CODE);
-			else
+			} else if (tf->tf_scause == SCAUSE_ECALL_USER) {
+				db_printf("--- syscall");
+				db_decode_syscall(td->td_sa.code, td);
+				db_printf("\n");
+			} else {
 				db_printf("--- exception %ld, tval = %#lx\n",
 				    tf->tf_scause & SCAUSE_CODE,
 				    tf->tf_stval);
+			}
 			frame->sp = tf->tf_sp;
 			frame->fp = tf->tf_s[0];
 			frame->pc = tf->tf_sepc;