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 Use db_read_value to read the trapframe...



details:   https://anonhg.NetBSD.org/src/rev/aedd76f79518
branches:  trunk
changeset: 781837:aedd76f79518
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Wed Oct 03 17:43:22 2012 +0000

description:
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

diffstat:

 sys/arch/amd64/amd64/db_machdep.c |  15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diffs (43 lines):

diff -r 0030b56dcc4c -r aedd76f79518 sys/arch/amd64/amd64/db_machdep.c
--- a/sys/arch/amd64/amd64/db_machdep.c Wed Oct 03 17:04:25 2012 +0000
+++ b/sys/arch/amd64/amd64/db_machdep.c Wed Oct 03 17:43:22 2012 +0000
@@ -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 @@
                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;



Home | Main Index | Thread Index | Old Index