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.
This commit is contained in:
parent
e8a16db246
commit
bfbf13730c
@ -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
|
||||
@ -198,6 +190,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,
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user