git: 791bfa60e8ac - main - riscv: decode syscall in ddb backtrace

From: Mitchell Horne <mhorne_at_FreeBSD.org>
Date: Mon, 03 Oct 2022 16:56:45 UTC
The branch main has been updated by mhorne:

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

commit 791bfa60e8ac85381d449bae5caa0999950a7039
Author:     Mitchell Horne <mhorne@FreeBSD.org>
AuthorDate: 2022-10-02 22:47:24 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2022-10-03 16:49:54 +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
---
 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;