Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/amd64/amd64 amd64: Print effective syscall number f...



details:   https://anonhg.NetBSD.org/src/rev/e552eceb0d53
branches:  trunk
changeset: 368177:e552eceb0d53
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Jun 26 22:31:12 2022 +0000

description:
amd64: Print effective syscall number for SYS_syscall stack traces.

This time with compile-testing, at least.

diffstat:

 sys/arch/amd64/amd64/db_machdep.c |  18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)

diffs (50 lines):

diff -r 689831447f26 -r e552eceb0d53 sys/arch/amd64/amd64/db_machdep.c
--- a/sys/arch/amd64/amd64/db_machdep.c Sun Jun 26 22:29:28 2022 +0000
+++ b/sys/arch/amd64/amd64/db_machdep.c Sun Jun 26 22:31:12 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: db_machdep.c,v 1.11 2022/06/26 22:29:28 riastradh Exp $        */
+/*     $NetBSD: db_machdep.c,v 1.12 2022/06/26 22:31:12 riastradh Exp $        */
 
 /*
  * Mach Operating System
@@ -26,11 +26,12 @@
  * rights to redistribute these changes.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.11 2022/06/26 22:29:28 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.12 2022/06/26 22:31:12 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/proc.h>
+#include <sys/syscall.h>
 
 #include <machine/frame.h>
 #include <machine/trap.h>
@@ -111,6 +112,7 @@
        struct x86_64_frame *fp;
        struct intrframe *ifp;
        int traptype, trapno, err, i;
+       db_expr_t syscallno;
 
        switch (is_trap) {
            case NONE:
@@ -127,8 +129,16 @@
 
            case SYSCALL:
                tf = (struct trapframe *)argp;
-               (*pr)("--- syscall (number %"DDB_EXPR_FMT"u) ---\n",
-                   db_get_value((long)&tf->tf_rax, 8, false));
+               syscallno = db_get_value((long)&tf->tf_rax, 8, false);
+               if (syscallno == SYS_syscall) {
+                       syscallno = db_get_value((long)&tf->tf_rdi, 8, false);
+                       (*pr)("--- syscall (number %"DDB_EXPR_FMT"u"
+                           " via SYS_syscall) ---\n",
+                           syscallno);
+               } else {
+                       (*pr)("--- syscall (number %"DDB_EXPR_FMT"u) ---\n",
+                           syscallno);
+               }
                return 0;
 
            case TRAP:



Home | Main Index | Thread Index | Old Index