Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/hppa/hppa Improve the output from frame_sanity_check.



details:   https://anonhg.NetBSD.org/src/rev/e98274f32f23
branches:  trunk
changeset: 753332:e98274f32f23
user:      skrll <skrll%NetBSD.org@localhost>
date:      Mon Mar 22 23:26:06 2010 +0000

description:
Improve the output from frame_sanity_check.

diffstat:

 sys/arch/hppa/hppa/trap.c |  34 +++++++++++++++++-----------------
 1 files changed, 17 insertions(+), 17 deletions(-)

diffs (115 lines):

diff -r 86f81c13bff9 -r e98274f32f23 sys/arch/hppa/hppa/trap.c
--- a/sys/arch/hppa/hppa/trap.c Mon Mar 22 23:21:29 2010 +0000
+++ b/sys/arch/hppa/hppa/trap.c Mon Mar 22 23:26:06 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap.c,v 1.80 2010/03/20 23:31:27 chs Exp $    */
+/*     $NetBSD: trap.c,v 1.81 2010/03/22 23:26:06 skrll Exp $  */
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.80 2010/03/20 23:31:27 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.81 2010/03/22 23:26:06 skrll Exp $");
 
 /* #define INTRDEBUG */
 /* #define TRAPDEBUG */
@@ -182,8 +182,9 @@
 #if defined(DEBUG)
 struct trapframe *sanity_frame;
 struct lwp *sanity_lwp;
-int sanity_checked = 0;
-void frame_sanity_check(int, int, struct trapframe *, struct lwp *);
+const char *sanity_string;
+void frame_sanity_check(const char *, int, int, struct trapframe *,
+    struct lwp *);
 #endif
 
 
@@ -408,7 +409,8 @@
  * with some documented elsewhere, some not.
  */
 void
-frame_sanity_check(int where, int type, struct trapframe *tf, struct lwp *l)
+frame_sanity_check(const char *func, int line, int type, struct trapframe *tf,
+    struct lwp *l)
 {
        extern int kernel_text;
        extern int etext;
@@ -419,7 +421,7 @@
        if (sanity_frame == NULL && !(e)) {             \
                sanity_frame = tf;                      \
                sanity_lwp = l;                         \
-               sanity_checked = __LINE__;              \
+               sanity_string = #e;                     \
        }                                               \
 } while (/* CONSTCOND */ 0)
 
@@ -469,14 +471,12 @@
 #undef SANITY
 out:
        if (sanity_frame == tf) {
-               printf("insanity: where 0x%x type 0x%x tf %p lwp %p line %d "
-                      "sp 0x%x pc 0x%x\n",
-                      where, type, sanity_frame, sanity_lwp, sanity_checked,
-                      tf->tf_sp, tf->tf_iioq_head);
+               printf("insanity: '%s' in func %s at line %d type 0x%x tf %p "
+                   "lwp %p sp 0x%x pc 0x%x\n", sanity_string, func, line, type,
+                   sanity_frame, sanity_lwp, tf->tf_sp, tf->tf_iioq_head);
                (void) trap_kdebug(T_IBREAK, 0, tf);
                sanity_frame = NULL;
                sanity_lwp = NULL;
-               sanity_checked = 0;
        }
 }
 #endif /* DEBUG */
@@ -555,7 +555,7 @@
 #endif /* DIAGNOSTIC */
                
 #ifdef DEBUG
-       frame_sanity_check(0xdead01, type, frame, l);
+       frame_sanity_check(__func__, __LINE__, type, frame, l);
 #endif /* DEBUG */
 
        if (frame->tf_flags & TFF_LAST)
@@ -970,9 +970,9 @@
                userret(l, l->l_md.md_regs->tf_iioq_head, 0);
 
 #ifdef DEBUG
-       frame_sanity_check(0xdead02, type, frame, l);
+       frame_sanity_check(__func__, __LINE__, type, frame, l);
        if (frame->tf_flags & TFF_LAST && (curlwp->l_flag & LW_IDLE) == 0)
-               frame_sanity_check(0xdead03, type, curlwp->l_md.md_regs,
+               frame_sanity_check(__func__, __LINE__, type, curlwp->l_md.md_regs,
                                   curlwp);
 #endif /* DEBUG */
 }
@@ -989,7 +989,7 @@
        userret(l, l->l_md.md_regs->tf_iioq_head, 0);
        ktrsysret(SYS_fork, 0, 0);
 #ifdef DEBUG
-       frame_sanity_check(0xdead04, 0, l->l_md.md_regs, l);
+       frame_sanity_check(__func__, __LINE__, 0, l->l_md.md_regs, l);
 #endif /* DEBUG */
 }
 
@@ -1115,7 +1115,7 @@
        uvmexp.syscalls++;
 
 #ifdef DEBUG
-       frame_sanity_check(0xdead04, 0, frame, curlwp);
+       frame_sanity_check(__func__, __LINE__, 0, frame, curlwp);
 #endif /* DEBUG */
 
        if (!USERMODE(frame->tf_iioq_head))
@@ -1287,7 +1287,7 @@
 #endif
 
 #ifdef DEBUG
-       frame_sanity_check(0xdead05, 0, frame, l);
+       frame_sanity_check(__func__, __LINE__, 0, frame, l);
 #endif /* DEBUG */
 }
 



Home | Main Index | Thread Index | Old Index