PERFORCE change 77411 for review
Peter Wemm
peter at FreeBSD.org
Tue May 24 21:04:58 GMT 2005
http://perforce.freebsd.org/chv.cgi?CH=77411
Change 77411 by peter at peter_melody on 2005/05/24 21:04:25
Add two more debug sysctl's to cause messier ways of entering the
debugger than the nice Debugger() call.
Affected files ...
.. //depot/projects/hammer/sys/kern/subr_kdb.c#10 edit
Differences ...
==== //depot/projects/hammer/sys/kern/subr_kdb.c#10 (text+ko) ====
@@ -66,6 +66,8 @@
static int kdb_sysctl_available(SYSCTL_HANDLER_ARGS);
static int kdb_sysctl_current(SYSCTL_HANDLER_ARGS);
static int kdb_sysctl_enter(SYSCTL_HANDLER_ARGS);
+static int kdb_sysctl_panic(SYSCTL_HANDLER_ARGS);
+static int kdb_sysctl_trap(SYSCTL_HANDLER_ARGS);
SYSCTL_NODE(_debug, OID_AUTO, kdb, CTLFLAG_RW, NULL, "KDB nodes");
@@ -78,6 +80,12 @@
SYSCTL_PROC(_debug_kdb, OID_AUTO, enter, CTLTYPE_INT | CTLFLAG_RW, 0, 0,
kdb_sysctl_enter, "I", "set to enter the debugger");
+SYSCTL_PROC(_debug_kdb, OID_AUTO, panic, CTLTYPE_INT | CTLFLAG_RW, 0, 0,
+ kdb_sysctl_panic, "I", "set to panic the kernel");
+
+SYSCTL_PROC(_debug_kdb, OID_AUTO, trap, CTLTYPE_INT | CTLFLAG_RW, 0, 0,
+ kdb_sysctl_trap, "I", "set cause a page fault");
+
/*
* Flag indicating whether or not to IPI the other CPUs to stop them on
* entering the debugger. Sometimes, this will result in a deadlock as
@@ -174,6 +182,38 @@
return (0);
}
+static int
+kdb_sysctl_panic(SYSCTL_HANDLER_ARGS)
+{
+ int error, i;
+
+ error = sysctl_wire_old_buffer(req, sizeof(int));
+ if (error == 0) {
+ i = 0;
+ error = sysctl_handle_int(oidp, &i, 0, req);
+ }
+ if (error != 0 || req->newptr == NULL)
+ return (error);
+ panic("kdb_sysctl_panic");
+ return (0);
+}
+
+static int
+kdb_sysctl_trap(SYSCTL_HANDLER_ARGS)
+{
+ int error, i;
+ int *addr = (int *)0x10;
+
+ error = sysctl_wire_old_buffer(req, sizeof(int));
+ if (error == 0) {
+ i = 0;
+ error = sysctl_handle_int(oidp, &i, 0, req);
+ }
+ if (error != 0 || req->newptr == NULL)
+ return (error);
+ return (*addr);
+}
+
/*
* Solaris implements a new BREAK which is initiated by a character sequence
* CR ~ ^b which is similar to a familiar pattern used on Sun servers by the
More information about the p4-projects
mailing list