diff options
author | marcel <marcel@FreeBSD.org> | 2004-07-12 01:15:55 +0000 |
---|---|---|
committer | marcel <marcel@FreeBSD.org> | 2004-07-12 01:15:55 +0000 |
commit | bfbf13730c3642d62a98570647d76bcf47e81066 (patch) | |
tree | 19b8172e8a6635245c93e3944760f5785b8a2785 /sys/kern | |
parent | e8a16db246b90d912e97fc36bc9384c7644fa415 (diff) | |
download | FreeBSD-src-bfbf13730c3642d62a98570647d76bcf47e81066.zip FreeBSD-src-bfbf13730c3642d62a98570647d76bcf47e81066.tar.gz |
Make kdb_dbbe_select() available as an interface function. This allows
changing the backend from outside the KDB frontend. For example from
within a backend. Rewrite kdb_sysctl_current to make use of this
function as well.
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 |