Module Name:    src
Committed By:   riz
Date:           Wed Oct 17 22:34:15 UTC 2012

Modified Files:
        src/sys/arch/amd64/amd64 [netbsd-6]: db_machdep.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #604):
        sys/arch/amd64/amd64/db_machdep.c: revision 1.4
Use db_read_value to read the trapframe fields in db_nextframe.
Fixes SIGSEGV on bt in crash(8) when the stack trace ends in syscall,
and probably other problems as well.
ok christos


To generate a diff of this commit:
cvs rdiff -u -r1.1.16.1 -r1.1.16.2 src/sys/arch/amd64/amd64/db_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/amd64/amd64/db_machdep.c
diff -u src/sys/arch/amd64/amd64/db_machdep.c:1.1.16.1 src/sys/arch/amd64/amd64/db_machdep.c:1.1.16.2
--- src/sys/arch/amd64/amd64/db_machdep.c:1.1.16.1	Thu Feb 23 18:36:06 2012
+++ src/sys/arch/amd64/amd64/db_machdep.c	Wed Oct 17 22:34:15 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_machdep.c,v 1.1.16.1 2012/02/23 18:36:06 riz Exp $	*/
+/*	$NetBSD: db_machdep.c,v 1.1.16.2 2012/10/17 22:34:15 riz 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.1.16.1 2012/02/23 18:36:06 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.1.16.2 2012/10/17 22:34:15 riz Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -134,17 +134,20 @@ db_nextframe(long **nextframe, long **re
 		tf = (struct trapframe *)argp;
 		switch (is_trap) {
 		case TRAP:
-			(*pr)("--- trap (number %d) ---\n", tf->tf_trapno);
+			(*pr)("--- trap (number %"DDB_EXPR_FMT"u) ---\n",
+				db_get_value((long)&tf->tf_trapno, 8, false));
 			break;
 		case SYSCALL:
-			(*pr)("--- syscall (number %ld) ---\n", tf->tf_rax);
+			(*pr)("--- syscall (number %"DDB_EXPR_FMT"u) ---\n",
+				db_get_value((long)&tf->tf_rax, 8, false));
 			break;
 		case INTERRUPT:
 			(*pr)("--- interrupt ---\n");
 			break;
 		}
-		*ip = (db_addr_t)tf->tf_rip;
-		fp = (struct x86_64_frame *)tf->tf_rbp;
+		*ip = (db_addr_t)db_get_value((long)&tf->tf_rip, 8, false);
+		fp = (struct x86_64_frame *)
+			db_get_value((long)&tf->tf_rbp, 8, false);
 		if (fp == NULL)
 			return 0;
 		*nextframe = (long *)&fp->f_frame;

Reply via email to