summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2004-07-12 01:15:55 +0000
committermarcel <marcel@FreeBSD.org>2004-07-12 01:15:55 +0000
commitbfbf13730c3642d62a98570647d76bcf47e81066 (patch)
tree19b8172e8a6635245c93e3944760f5785b8a2785 /sys
parente8a16db246b90d912e97fc36bc9384c7644fa415 (diff)
downloadFreeBSD-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')
-rw-r--r--sys/kern/subr_kdb.c29
-rw-r--r--sys/sys/kdb.h1
2 files changed, 21 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
diff --git a/sys/sys/kdb.h b/sys/sys/kdb.h
index f7c0988..6a1b8f7 100644
--- a/sys/sys/kdb.h
+++ b/sys/sys/kdb.h
@@ -64,6 +64,7 @@ extern struct thread *kdb_thread; /* Current thread. */
int kdb_alt_break(int, int *);
void kdb_backtrace(void);
+int kdb_dbbe_select(const char *);
void kdb_enter(const char *);
void kdb_init(void);
void * kdb_jmpbuf(jmp_buf);
OpenPOWER on IntegriCloud