Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/subr_kdb.c
Show First 20 Lines • Show All 76 Lines • ▼ Show 20 Lines | |||||
static int kdb_alt_break_to_debugger = KDB_ALT_BREAK_TO_DEBUGGER; | static int kdb_alt_break_to_debugger = KDB_ALT_BREAK_TO_DEBUGGER; | ||||
KDB_BACKEND(null, NULL, NULL, NULL, NULL); | KDB_BACKEND(null, NULL, NULL, NULL, NULL); | ||||
static int kdb_sysctl_available(SYSCTL_HANDLER_ARGS); | static int kdb_sysctl_available(SYSCTL_HANDLER_ARGS); | ||||
static int kdb_sysctl_current(SYSCTL_HANDLER_ARGS); | static int kdb_sysctl_current(SYSCTL_HANDLER_ARGS); | ||||
static int kdb_sysctl_enter(SYSCTL_HANDLER_ARGS); | static int kdb_sysctl_enter(SYSCTL_HANDLER_ARGS); | ||||
static int kdb_sysctl_panic(SYSCTL_HANDLER_ARGS); | static int kdb_sysctl_panic(SYSCTL_HANDLER_ARGS); | ||||
static int kdb_sysctl_panic_str(SYSCTL_HANDLER_ARGS); | |||||
static int kdb_sysctl_trap(SYSCTL_HANDLER_ARGS); | static int kdb_sysctl_trap(SYSCTL_HANDLER_ARGS); | ||||
static int kdb_sysctl_trap_code(SYSCTL_HANDLER_ARGS); | static int kdb_sysctl_trap_code(SYSCTL_HANDLER_ARGS); | ||||
static int kdb_sysctl_stack_overflow(SYSCTL_HANDLER_ARGS); | static int kdb_sysctl_stack_overflow(SYSCTL_HANDLER_ARGS); | ||||
static SYSCTL_NODE(_debug, OID_AUTO, kdb, CTLFLAG_RW | CTLFLAG_MPSAFE, NULL, | static SYSCTL_NODE(_debug, OID_AUTO, kdb, CTLFLAG_RW | CTLFLAG_MPSAFE, NULL, | ||||
"KDB nodes"); | "KDB nodes"); | ||||
SYSCTL_PROC(_debug_kdb, OID_AUTO, available, | SYSCTL_PROC(_debug_kdb, OID_AUTO, available, | ||||
Show All 11 Lines | SYSCTL_PROC(_debug_kdb, OID_AUTO, enter, | ||||
kdb_sysctl_enter, "I", | kdb_sysctl_enter, "I", | ||||
"set to enter the debugger"); | "set to enter the debugger"); | ||||
SYSCTL_PROC(_debug_kdb, OID_AUTO, panic, | SYSCTL_PROC(_debug_kdb, OID_AUTO, panic, | ||||
CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_SECURE | CTLFLAG_MPSAFE, NULL, 0, | CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_SECURE | CTLFLAG_MPSAFE, NULL, 0, | ||||
kdb_sysctl_panic, "I", | kdb_sysctl_panic, "I", | ||||
"set to panic the kernel"); | "set to panic the kernel"); | ||||
SYSCTL_PROC(_debug_kdb, OID_AUTO, panic_str, | |||||
CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_SECURE | CTLFLAG_MPSAFE, NULL, 0, | |||||
kdb_sysctl_panic_str, "A", | |||||
"set to panic the kernel"); | |||||
emaste: `panic the kernel with the provided string as the panic message`? | |||||
SYSCTL_PROC(_debug_kdb, OID_AUTO, trap, | SYSCTL_PROC(_debug_kdb, OID_AUTO, trap, | ||||
CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_SECURE | CTLFLAG_MPSAFE, NULL, 0, | CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_SECURE | CTLFLAG_MPSAFE, NULL, 0, | ||||
kdb_sysctl_trap, "I", | kdb_sysctl_trap, "I", | ||||
"set to cause a page fault via data access"); | "set to cause a page fault via data access"); | ||||
SYSCTL_PROC(_debug_kdb, OID_AUTO, trap_code, | SYSCTL_PROC(_debug_kdb, OID_AUTO, trap_code, | ||||
CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_SECURE | CTLFLAG_MPSAFE, NULL, 0, | CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_SECURE | CTLFLAG_MPSAFE, NULL, 0, | ||||
kdb_sysctl_trap_code, "I", | kdb_sysctl_trap_code, "I", | ||||
▲ Show 20 Lines • Show All 78 Lines • ▼ Show 20 Lines | kdb_sysctl_panic(SYSCTL_HANDLER_ARGS) | ||||
error = sysctl_wire_old_buffer(req, sizeof(int)); | error = sysctl_wire_old_buffer(req, sizeof(int)); | ||||
if (error == 0) { | if (error == 0) { | ||||
i = 0; | i = 0; | ||||
error = sysctl_handle_int(oidp, &i, 0, req); | error = sysctl_handle_int(oidp, &i, 0, req); | ||||
} | } | ||||
if (error != 0 || req->newptr == NULL) | if (error != 0 || req->newptr == NULL) | ||||
return (error); | return (error); | ||||
panic("kdb_sysctl_panic"); | panic("kdb_sysctl_panic"); | ||||
return (0); | |||||
} | |||||
static int | |||||
kdb_sysctl_panic_str(SYSCTL_HANDLER_ARGS) | |||||
{ | |||||
int error; | |||||
static char buf[256]; /* static buffer to limit mallocs when panicing */ | |||||
*buf = '\0'; | |||||
error = sysctl_handle_string(oidp, buf, sizeof(buf), req); | |||||
if (error != 0 || req->newptr == NULL) | |||||
return (error); | |||||
panic("kdb_sysctl_panic: %s", buf); | |||||
return (0); | return (0); | ||||
} | } | ||||
Not Done Inline Actionsconfused by this part emaste: confused by this part | |||||
static int | static int | ||||
kdb_sysctl_trap(SYSCTL_HANDLER_ARGS) | kdb_sysctl_trap(SYSCTL_HANDLER_ARGS) | ||||
{ | { | ||||
int error, i; | int error, i; | ||||
int *addr = (int *)0x10; | int *addr = (int *)0x10; | ||||
error = sysctl_wire_old_buffer(req, sizeof(int)); | error = sysctl_wire_old_buffer(req, sizeof(int)); | ||||
if (error == 0) { | if (error == 0) { | ||||
▲ Show 20 Lines • Show All 515 Lines • Show Last 20 Lines |
panic the kernel with the provided string as the panic message?