aboutsummaryrefslogtreecommitdiff
path: root/gdb/cli
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2005-02-16 17:20:59 +0000
committerAndrew Cagney <cagney@redhat.com>2005-02-16 17:20:59 +0000
commit085461598022e08faf7ea3cb5def97dd04dc104b (patch)
tree66d39a6b97951d3f3c089363ab4aad929ae2b12e /gdb/cli
parentb8285c27bd2e8eee65d32f37fbb804890b21cd5e (diff)
downloadgdb-085461598022e08faf7ea3cb5def97dd04dc104b.zip
gdb-085461598022e08faf7ea3cb5def97dd04dc104b.tar.gz
gdb-085461598022e08faf7ea3cb5def97dd04dc104b.tar.bz2
2005-02-16 Andrew Cagney <cagney@gnu.org>
Merge setshow print and show parameters. * command.h (show_value_ftype): Define. (deprecated_show_value_hack): Declare. (add_setshow_enum_cmd, add_setshow_auto_boolean_cmd) (add_setshow_boolean_cmd, add_setshow_filename_cmd) (add_setshow_string_cmd, add_setshow_uinteger_cmd) (add_setshow_zinteger_cmd): Change type of show_func to show_value_ftype. * cli/cli-decode.h (struct cmd_list_element): Replace fprint_setshow with show_value_func. * cli/cli-decode.c (add_setshow_cmd_full): Update show_func parameter. Set show_value_func. Do not set cmd_sfunc. (add_setshow_enum_cmd, add_setshow_auto_boolean_cmd) (add_setshow_boolean_cmd, add_setshow_filename_cmd) (add_setshow_string_cmd, add_setshow_uinteger_cmd) (add_setshow_zinteger_cmd): Update. * complaints.c (complaints_show_value): Replace fprint_setshow_complaints. (_initialize_complaints): Update. * mips-tdep.c (show_mask_address): Update. * arm-tdep.c (show_fp_model): Update. * cli/cli-setshow.c (do_setshow_command): Call show_value_func instead of fprint_setshow. Use deprecated_show_value_hack. (deprecated_show_value_hack): New function. * remote.c (add_packet_config_cmd, show_remote_cmd): (show_remote_protocol_P_packet_cmd) (show_remote_protocol_P_packet_cmd) (show_remote_protocol_Z_access_wp_packet_cmd) (show_remote_protocol_Z_hardware_bp_packet_cmd) (show_remote_protocol_Z_packet_cmd) (show_remote_protocol_Z_read_wp_packet_cmd) (show_remote_protocol_Z_software_bp_packet_cmd) (show_remote_protocol_Z_write_wp_packet_cmd) (show_remote_protocol_binary_download_cmd) (show_remote_protocol_p_packet_cmd) (show_remote_protocol_qPart_auxv_packet_cmd) (show_remote_protocol_qSymbol_packet_cmd) (show_remote_protocol_vcont_packet_cmd): Update.
Diffstat (limited to 'gdb/cli')
-rw-r--r--gdb/cli/cli-decode.c21
-rw-r--r--gdb/cli/cli-decode.h2
-rw-r--r--gdb/cli/cli-setshow.c49
3 files changed, 37 insertions, 35 deletions
diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index 883f7d0..eb126ef 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -333,7 +333,7 @@ add_setshow_cmd_full (char *name,
const char *help_doc,
fprint_setshow_ftype *fprint_setshow,
cmd_sfunc_ftype *set_func,
- cmd_sfunc_ftype *show_func,
+ show_value_ftype *show_func,
struct cmd_list_element **set_list,
struct cmd_list_element **show_list,
struct cmd_list_element **set_result,
@@ -360,10 +360,7 @@ add_setshow_cmd_full (char *name,
set_cmd_sfunc (set, set_func);
show = add_set_or_show_cmd (name, show_cmd, class, var_type, var,
full_show_doc, show_list);
- show->fprint_setshow = fprint_setshow;
-
- if (show_func != NULL)
- set_cmd_sfunc (show, show_func);
+ show->show_value_func = show_func;
if (set_result != NULL)
*set_result = set;
@@ -420,7 +417,7 @@ add_setshow_enum_cmd (char *name,
const char *help_doc,
fprint_setshow_ftype *fprint_setshow,
cmd_sfunc_ftype *set_func,
- cmd_sfunc_ftype *show_func,
+ show_value_ftype *show_func,
struct cmd_list_element **set_list,
struct cmd_list_element **show_list)
{
@@ -446,7 +443,7 @@ add_setshow_auto_boolean_cmd (char *name,
const char *help_doc,
fprint_setshow_ftype *fprint_setshow,
cmd_sfunc_ftype *set_func,
- cmd_sfunc_ftype *show_func,
+ show_value_ftype *show_func,
struct cmd_list_element **set_list,
struct cmd_list_element **show_list)
{
@@ -470,7 +467,7 @@ add_setshow_boolean_cmd (char *name, enum command_class class, int *var,
const char *help_doc,
fprint_setshow_ftype *fprint_setshow,
cmd_sfunc_ftype *set_func,
- cmd_sfunc_ftype *show_func,
+ show_value_ftype *show_func,
struct cmd_list_element **set_list,
struct cmd_list_element **show_list)
{
@@ -493,7 +490,7 @@ add_setshow_filename_cmd (char *name, enum command_class class,
const char *help_doc,
fprint_setshow_ftype *fprint_setshow,
cmd_sfunc_ftype *set_func,
- cmd_sfunc_ftype *show_func,
+ show_value_ftype *show_func,
struct cmd_list_element **set_list,
struct cmd_list_element **show_list)
{
@@ -513,7 +510,7 @@ add_setshow_string_cmd (char *name, enum command_class class,
const char *help_doc,
fprint_setshow_ftype *fprint_setshow,
cmd_sfunc_ftype *set_func,
- cmd_sfunc_ftype *show_func,
+ show_value_ftype *show_func,
struct cmd_list_element **set_list,
struct cmd_list_element **show_list)
{
@@ -535,7 +532,7 @@ add_setshow_uinteger_cmd (char *name, enum command_class class,
const char *help_doc,
fprint_setshow_ftype *fprint_setshow,
cmd_sfunc_ftype *set_func,
- cmd_sfunc_ftype *show_func,
+ show_value_ftype *show_func,
struct cmd_list_element **set_list,
struct cmd_list_element **show_list)
{
@@ -557,7 +554,7 @@ add_setshow_zinteger_cmd (char *name, enum command_class class,
const char *help_doc,
fprint_setshow_ftype *fprint_setshow,
cmd_sfunc_ftype *set_func,
- cmd_sfunc_ftype *show_func,
+ show_value_ftype *show_func,
struct cmd_list_element **set_list,
struct cmd_list_element **show_list)
{
diff --git a/gdb/cli/cli-decode.h b/gdb/cli/cli-decode.h
index d00ff09..9ffe2c5 100644
--- a/gdb/cli/cli-decode.h
+++ b/gdb/cli/cli-decode.h
@@ -90,7 +90,7 @@ struct cmd_list_element
/* For set/show commands. A method for printing the output to the
specified stream. */
- fprint_setshow_ftype *fprint_setshow;
+ show_value_ftype *show_value_func;
/* flags : a bitfield
diff --git a/gdb/cli/cli-setshow.c b/gdb/cli/cli-setshow.c
index b0c0acd..993ca5c 100644
--- a/gdb/cli/cli-setshow.c
+++ b/gdb/cli/cli-setshow.c
@@ -90,6 +90,28 @@ parse_binary_operation (char *arg)
}
}
+void
+deprecated_show_value_hack (struct ui_file *ignore_file,
+ int ignore_from_tty,
+ struct cmd_list_element *c,
+ const char *value)
+{
+ /* Print doc minus "show" at start. */
+ print_doc_line (gdb_stdout, c->doc + 5);
+ switch (c->var_type)
+ {
+ case var_string:
+ case var_string_noescape:
+ case var_filename:
+ case var_enum:
+ printf_filtered ((" is \"%s\".\n"), value);
+ break;
+ default:
+ printf_filtered ((" is %s.\n"), value);
+ break;
+ }
+}
+
/* Do a "set" or "show" command. ARG is NULL if no argument, or the text
of the argument, and FROM_TTY is nonzero if this command is being entered
directly by the user (i.e. these are just like any other
@@ -257,7 +279,6 @@ do_setshow_command (char *arg, int from_tty, struct cmd_list_element *c)
{
struct cleanup *old_chain;
struct ui_stream *stb;
- int quote;
stb = ui_out_stream_new (uiout);
old_chain = make_cleanup_ui_out_stream_delete (stb);
@@ -266,7 +287,6 @@ do_setshow_command (char *arg, int from_tty, struct cmd_list_element *c)
if (c->pre_show_hook)
(c->pre_show_hook) (c);
- quote = 0;
switch (c->var_type)
{
case var_string:
@@ -275,7 +295,6 @@ do_setshow_command (char *arg, int from_tty, struct cmd_list_element *c)
if (*(unsigned char **) c->var)
fputstr_filtered (*(unsigned char **) c->var, '"', stb->stream);
- quote = 1;
}
break;
case var_string_noescape:
@@ -283,7 +302,6 @@ do_setshow_command (char *arg, int from_tty, struct cmd_list_element *c)
case var_enum:
if (*(char **) c->var)
fputs_filtered (*(char **) c->var, stb->stream);
- quote = 1;
break;
case var_boolean:
fputs_filtered (*(int *) c->var ? "on" : "off", stb->stream);
@@ -337,28 +355,15 @@ do_setshow_command (char *arg, int from_tty, struct cmd_list_element *c)
if (ui_out_is_mi_like_p (uiout))
ui_out_field_stream (uiout, "value", stb);
- else if (c->fprint_setshow != NULL)
+ else
{
long length;
char *value = ui_file_xstrdup (stb->stream, &length);
make_cleanup (xfree, value);
- c->fprint_setshow (c, gdb_stdout, value);
- fprintf_filtered (gdb_stdout, "\n");
- }
- else
- {
- /* Print doc minus "show" at start. */
- print_doc_line (gdb_stdout, c->doc + 5);
-
- ui_out_text (uiout, " is ");
- ui_out_wrap_hint (uiout, " ");
- if (quote)
- ui_out_text (uiout, "\"");
- ui_out_field_stream (uiout, "value", stb);
- if (quote)
- ui_out_text (uiout, "\"");
- ui_out_text (uiout, ".\n");
- do_cleanups (old_chain);
+ if (c->show_value_func != NULL)
+ c->show_value_func (gdb_stdout, from_tty, c, value);
+ else
+ deprecated_show_value_hack (gdb_stdout, from_tty, c, value);
}
do_cleanups (old_chain);
}