diff options
Diffstat (limited to 'gdb/cli')
-rw-r--r-- | gdb/cli/cli-decode.c | 8 | ||||
-rw-r--r-- | gdb/cli/cli-decode.h | 10 |
2 files changed, 14 insertions, 4 deletions
diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c index 556c027..8760ebf 100644 --- a/gdb/cli/cli-decode.c +++ b/gdb/cli/cli-decode.c @@ -132,7 +132,8 @@ cmd_type (struct cmd_list_element *cmd) void set_cmd_completer (struct cmd_list_element *cmd, - char **(*completer) (char *text, char *word)) + char **(*completer) (struct cmd_list_element *self, + char *text, char *word)) { cmd->completer = completer; /* Ok. */ } @@ -207,7 +208,8 @@ add_cmd (char *name, enum command_class class, void (*fun) (char *, int), c->prefixname = NULL; c->allow_unknown = 0; c->abbrev_flag = 0; - set_cmd_completer (c, make_symbol_completion_list); + set_cmd_completer (c, make_symbol_completion_list_fn); + c->destroyer = NULL; c->type = not_set_cmd; c->var = NULL; c->var_type = var_boolean; @@ -688,6 +690,8 @@ delete_cmd (char *name, struct cmd_list_element **list, { if (strcmp (iter->name, name) == 0) { + if (iter->destroyer) + iter->destroyer (iter, iter->context); if (iter->hookee_pre) iter->hookee_pre->hook_pre = 0; *prehook = iter->hook_pre; diff --git a/gdb/cli/cli-decode.h b/gdb/cli/cli-decode.h index 56ea9bf..26ca2f7 100644 --- a/gdb/cli/cli-decode.h +++ b/gdb/cli/cli-decode.h @@ -167,7 +167,12 @@ struct cmd_list_element returned relative to this position. For example, suppose TEXT is "foo" and we want to complete to "foobar". If WORD is "oo", return "oobar"; if WORD is "baz/foo", return "baz/foobar". */ - char **(*completer) (char *text, char *word); + char **(*completer) (struct cmd_list_element *cmd, char *text, char *word); + + /* Destruction routine for this command. If non-NULL, this is + called when this command instance is destroyed. This may be + used to finalize the CONTEXT field, if needed. */ + void (*destroyer) (struct cmd_list_element *self, void *context); /* Type of "set" or "show" command (or SET_NOT_SET if not "set" or "show"). */ @@ -242,7 +247,8 @@ extern void set_cmd_sfunc (struct cmd_list_element *cmd, struct cmd_list_element * c)); extern void set_cmd_completer (struct cmd_list_element *cmd, - char **(*completer) (char *text, char *word)); + char **(*completer) (struct cmd_list_element *self, + char *text, char *word)); /* HACK: cagney/2002-02-23: Code, mostly in tracepoints.c, grubs around in cmd objects to test the value of the commands sfunc(). */ |