Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Dec 2012 23:11:26 +0000 (UTC)
From:      Alfred Perlstein <alfred@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r244099 - head/sys/kern
Message-ID:  <201212102311.qBANBQwt034367@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: alfred
Date: Mon Dec 10 23:11:26 2012
New Revision: 244099
URL: http://svnweb.freebsd.org/changeset/base/244099

Log:
  allow KASSERT to enter KDB.

Modified:
  head/sys/kern/kern_shutdown.c

Modified: head/sys/kern/kern_shutdown.c
==============================================================================
--- head/sys/kern/kern_shutdown.c	Mon Dec 10 23:09:55 2012	(r244098)
+++ head/sys/kern/kern_shutdown.c	Mon Dec 10 23:11:26 2012	(r244099)
@@ -542,6 +542,9 @@ shutdown_reset(void *junk, int howto)
 
 #ifdef INVARIANTS
 static int kassert_warn_only = 0;
+#ifdef KDB
+static int kassert_do_kdb = 0;
+#endif
 #ifdef KTR
 static int kassert_do_ktr = 0;
 #endif
@@ -558,6 +561,12 @@ SYSCTL_INT(_debug_kassert, OID_AUTO, war
     "KASSERT triggers a panic (1) or just a warning (0)");
 TUNABLE_INT("debug.kassert.warn_only", &kassert_warn_only);
 
+#ifdef KDB
+SYSCTL_INT(_debug_kassert, OID_AUTO, do_kdb, CTLFLAG_RW | CTLFLAG_TUN,
+    &kassert_do_kdb, 0, "KASSERT will enter the debugger");
+TUNABLE_INT("debug.kassert.do_kdb", &kassert_do_kdb);
+#endif
+
 #ifdef KTR
 SYSCTL_UINT(_debug_kassert, OID_AUTO, do_ktr, CTLFLAG_RW | CTLFLAG_TUN,
     &kassert_do_ktr, 0,
@@ -650,6 +659,11 @@ kassert_panic(const char *fmt, ...)
 			kdb_backtrace();
 		}
 	}
+#ifdef KDB
+	if (kassert_do_kdb) {
+		kdb_enter(KDB_WHY_KASSERT, buf);
+	}
+#endif
 	atomic_add_int(&kassert_warnings, 1);
 }
 #endif



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201212102311.qBANBQwt034367>