aboutsummaryrefslogtreecommitdiff
path: root/gdb/cli
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/cli')
-rw-r--r--gdb/cli/cli-decode.h6
-rw-r--r--gdb/cli/cli-setshow.c4
2 files changed, 9 insertions, 1 deletions
diff --git a/gdb/cli/cli-decode.h b/gdb/cli/cli-decode.h
index d35685c..e9e354e 100644
--- a/gdb/cli/cli-decode.h
+++ b/gdb/cli/cli-decode.h
@@ -128,7 +128,7 @@ struct cmd_list_element
/* If type is not_set_cmd, call it like this: */
void (*cfunc) (char *args, int from_tty);
- /* If type is cmd_set or show_cmd, first set the variables, and
+ /* If type is set_cmd or show_cmd, first set the variables, and
then call this. */
void (*sfunc) (char *args, int from_tty, struct cmd_list_element * c);
}
@@ -166,6 +166,10 @@ struct cmd_list_element
/* if this command is deprecated, this is the replacement name */
char *replacement;
+ /* If this command represents a show command, then this function
+ is called before the variable's value is examined. */
+ void (*pre_show_hook) (struct cmd_list_element *c);
+
/* Hook for another command to be executed before this command. */
struct cmd_list_element *hook_pre;
diff --git a/gdb/cli/cli-setshow.c b/gdb/cli/cli-setshow.c
index bd3dd1a..3489fc0 100644
--- a/gdb/cli/cli-setshow.c
+++ b/gdb/cli/cli-setshow.c
@@ -267,6 +267,10 @@ do_setshow_command (char *arg, int from_tty, struct cmd_list_element *c)
old_chain = make_cleanup_ui_out_stream_delete (stb);
#endif /* UI_OUT */
+ /* Possibly call the pre hook. */
+ if (c->pre_show_hook)
+ (c->pre_show_hook) (c);
+
/* Print doc minus "show" at start. */
print_doc_line (gdb_stdout, c->doc + 5);