Module Name:    src
Committed By:   skrll
Date:           Mon Mar 22 23:26:06 UTC 2010

Modified Files:
        src/sys/arch/hppa/hppa: trap.c

Log Message:
Improve the output from frame_sanity_check.


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 src/sys/arch/hppa/hppa/trap.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/hppa/hppa/trap.c
diff -u src/sys/arch/hppa/hppa/trap.c:1.80 src/sys/arch/hppa/hppa/trap.c:1.81
--- src/sys/arch/hppa/hppa/trap.c:1.80	Sat Mar 20 23:31:27 2010
+++ src/sys/arch/hppa/hppa/trap.c	Mon Mar 22 23:26:06 2010
@@ -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 */
 }
 

Reply via email to