PERFORCE change 134931 for review

John Birrell jb at FreeBSD.org
Wed Feb 6 14:03:57 PST 2008


http://perforce.freebsd.org/chv.cgi?CH=134931

Change 134931 by jb at jb_freebsd1 on 2008/02/06 22:03:40

	Add a kdb_enter() stub to the DTrace kernel hooks stuff for the case
	when the kernel is built without KDB. I don't want DTrace to panic
	when a DTrace breakpoint is used without KDB.
	
	Add the call to kdb_enter() in the DTrace breakpoint action code.

Affected files ...

.. //depot/projects/dtrace/src/sys/contrib/opensolaris/uts/common/dtrace/dtrace.c#33 edit
.. //depot/projects/dtrace/src/sys/kern/kern_dtrace.c#5 edit

Differences ...

==== //depot/projects/dtrace/src/sys/contrib/opensolaris/uts/common/dtrace/dtrace.c#33 (text) ====

@@ -113,6 +113,7 @@
 #if !defined(sun)
 #include <sys/ctype.h>
 #include <sys/limits.h>
+#include <sys/kdb.h>
 #include <sys/kernel.h>
 #include <sys/malloc.h>
 #include <sys/sysctl.h>
@@ -5374,9 +5375,10 @@
 	c[i++] = ')';
 	c[i] = '\0';
 
-printf("%s(%d): DOODAD\n",__func__,__LINE__);
-#ifdef DOODAD
+#if defined(sun)
 	debug_enter(c);
+#else
+	kdb_enter(KDB_WHY_DTRACE, "breakpoint action");
 #endif
 }
 

==== //depot/projects/dtrace/src/sys/kern/kern_dtrace.c#5 (text+ko) ====

@@ -27,9 +27,12 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
+#include "opt_kdb.h"
+
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/eventhandler.h>
+#include <sys/kdb.h>
 #include <sys/kernel.h>
 #include <sys/malloc.h>
 #include <sys/proc.h>
@@ -103,3 +106,15 @@
 }
 
 SYSINIT(kdtrace, SI_SUB_KDTRACE, SI_ORDER_FIRST, init_dtrace, NULL)
+
+#ifndef KDB
+/*
+ * This is a stub for the kernel debugger for the DTrace actions to call
+ * when the kernel has been built without KDB.
+ */
+void
+kdb_enter(const char *why, const char *msg)
+{
+	printf("Cannot enter kernel debugger - No KDB in kernel.\n%s - %s\n", why, msg);
+}
+#endif


More information about the p4-projects mailing list