Module Name:    src
Committed By:   riastradh
Date:           Wed Oct  3 17:43:22 UTC 2012

Modified Files:
        src/sys/arch/amd64/amd64: db_machdep.c

Log Message:
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.3 -r1.4 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.3 src/sys/arch/amd64/amd64/db_machdep.c:1.4
--- src/sys/arch/amd64/amd64/db_machdep.c:1.3	Thu Jul 12 17:14:39 2012
+++ src/sys/arch/amd64/amd64/db_machdep.c	Wed Oct  3 17:43:22 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_machdep.c,v 1.3 2012/07/12 17:14:39 dsl Exp $	*/
+/*	$NetBSD: db_machdep.c,v 1.4 2012/10/03 17:43:22 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.3 2012/07/12 17:14:39 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.4 2012/10/03 17:43:22 riastradh 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