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/8b00eedf8add
branches:  trunk
changeset: 368175:8b00eedf8add
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Jun 26 22:18:30 2022 +0000

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

diffstat:

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

diffs (45 lines):

diff -r 384f75303d52 -r 8b00eedf8add sys/arch/amd64/amd64/db_machdep.c
--- a/sys/arch/amd64/amd64/db_machdep.c Sun Jun 26 21:42:19 2022 +0000
+++ b/sys/arch/amd64/amd64/db_machdep.c Sun Jun 26 22:18:30 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: db_machdep.c,v 1.9 2021/12/13 01:25:29 chs Exp $       */
+/*     $NetBSD: db_machdep.c,v 1.10 2022/06/26 22:18:30 riastradh Exp $        */
 
 /*
  * Mach Operating System
@@ -26,7 +26,7 @@
  * rights to redistribute these changes.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.9 2021/12/13 01:25:29 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.10 2022/06/26 22:18:30 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -111,6 +111,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 +128,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