diff options
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/subr_kdb.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/sys/kern/subr_kdb.c b/sys/kern/subr_kdb.c index 1c91deb..0fc015e 100644 --- a/sys/kern/subr_kdb.c +++ b/sys/kern/subr_kdb.c @@ -101,7 +101,6 @@ static int kdb_sysctl_current(SYSCTL_HANDLER_ARGS) { char buf[16]; - struct kdb_dbbe *be, **iter; int error; if (kdb_dbbe != NULL) { @@ -114,14 +113,7 @@ kdb_sysctl_current(SYSCTL_HANDLER_ARGS) return (error); if (kdb_active) return (EBUSY); - SET_FOREACH(iter, kdb_dbbe_set) { - be = *iter; - if (be->dbbe_active == 0 && strcmp(be->dbbe_name, buf) == 0) { - kdb_dbbe = be; - return (0); - } - } - return (EINVAL); + return (kdb_dbbe_select(buf)); } static int @@ -199,6 +191,25 @@ kdb_backtrace() } /* + * Set/change the current backend. + */ + +int +kdb_dbbe_select(const char *name) +{ + struct kdb_dbbe *be, **iter; + + SET_FOREACH(iter, kdb_dbbe_set) { + be = *iter; + if (be->dbbe_active == 0 && strcmp(be->dbbe_name, name) == 0) { + kdb_dbbe = be; + return (0); + } + } + return (EINVAL); +} + +/* * Enter the currently selected debugger. If a message has been provided, * it is printed first. If the debugger does not support the enter method, * it is entered by using breakpoint(), which enters the debugger through |