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:
Marcel Moolenaar 2004-07-12 01:15:55 +00:00
parent 074c7af19b
commit 3bcd2440db
2 changed files with 21 additions and 9 deletions

View File

@ -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,

View File

@ -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);