This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[commit] setshow fprint_setshow and show_func parameters
- From: Andrew Cagney <cagney at gnu dot org>
- To: gdb-patches at sources dot redhat dot com
- Date: Wed, 16 Feb 2005 12:33:39 -0500
- Subject: [commit] setshow fprint_setshow and show_func parameters
The add_setshow_* functions currently take two parameters for printing a
value, each possibly called in turn. For instance "show remote
P-packet" prints:
Current use of remote protocol `P' (set-register) packet is auto.
Support for remote protocol `P' (set-register) packet is
auto-detected, currently unknown.
The first line is from fprint_showfunc (well should be), and the second
from show_func.
This patch simplifies things by merging these two functions into a
single show_value function responsible for printing the entire output.
Any existing show_func / fprint_setshow functions are then updated (I
added deprecated_show_value_hack to simplify that step).
I'll follow up with a patch to remove the now defunct fprint_setshow
parameter (I kept it separate to make this patch simpler).
committed,
Andrew
2005-02-16 Andrew Cagney <cagney@gnu.org>
* 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.
Index: arm-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/arm-tdep.c,v
retrieving revision 1.190
diff -p -u -r1.190 arm-tdep.c
--- arm-tdep.c 14 Feb 2005 16:18:38 -0000 1.190
+++ arm-tdep.c 16 Feb 2005 17:19:15 -0000
@@ -2396,11 +2396,12 @@ set_fp_model_sfunc (char *args, int from
}
static void
-show_fp_model (char *args, int from_tty,
- struct cmd_list_element *c)
+show_fp_model (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c, const char *value)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+ deprecated_show_value_hack (file, from_tty, c, value);
if (arm_fp_model == ARM_FLOAT_AUTO
&& gdbarch_bfd_arch_info (current_gdbarch)->arch == bfd_arch_arm)
/* i18n: "the default [floating point model] for the current ABI..." */
Index: command.h
===================================================================
RCS file: /cvs/src/src/gdb/command.h,v
retrieving revision 1.45
diff -p -u -r1.45 command.h
--- command.h 10 Feb 2005 17:32:47 -0000 1.45
+++ command.h 16 Feb 2005 17:19:15 -0000
@@ -230,6 +230,17 @@ typedef void (fprint_setshow_ftype) (str
struct ui_file *file,
const char *value);
+/* Method for show a set/show variable's VALUE on FILE. If this
+ method isn't supplied deprecated_show_value_hack() is called (which
+ is not good). */
+typedef void (show_value_ftype) (struct ui_file *file,
+ int from_tty,
+ struct cmd_list_element *cmd,
+ const char *value);
+/* NOTE: i18n: This function is not i18n friendly. Callers should
+ instead print the value out directly. */
+extern show_value_ftype deprecated_show_value_hack;
+
extern void add_setshow_enum_cmd (char *name,
enum command_class class,
const char *enumlist[],
@@ -239,7 +250,7 @@ extern void add_setshow_enum_cmd (char *
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);
@@ -251,7 +262,7 @@ extern void add_setshow_auto_boolean_cmd
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);
@@ -261,7 +272,7 @@ extern void add_setshow_boolean_cmd (cha
const char *set_doc, const char *show_doc,
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);
@@ -273,7 +284,7 @@ extern void add_setshow_filename_cmd (ch
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);
@@ -285,7 +296,7 @@ extern void add_setshow_string_cmd (char
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);
@@ -297,7 +308,7 @@ extern void add_setshow_uinteger_cmd (ch
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);
@@ -309,7 +320,7 @@ extern void add_setshow_zinteger_cmd (ch
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);
Index: complaints.c
===================================================================
RCS file: /cvs/src/src/gdb/complaints.c,v
retrieving revision 1.19
diff -p -u -r1.19 complaints.c
--- complaints.c 10 Feb 2005 17:32:47 -0000 1.19
+++ complaints.c 16 Feb 2005 17:19:15 -0000
@@ -310,12 +310,11 @@ clear_complaints (struct complaints **c,
}
static void
-fprint_setshow_complaints (struct cmd_list_element *cmd,
- struct ui_file *file,
- const char *value)
+complaints_show_value (struct ui_file *file, int from_tty,
+ struct cmd_list_element *cmd, const char *value)
{
fprintf_filtered (file, _("Max number of complaints about incorrect"
- " symbols is %s."),
+ " symbols is %s.\n"),
value);
}
@@ -325,8 +324,7 @@ _initialize_complaints (void)
add_setshow_zinteger_cmd ("complaints", class_support, &stop_whining, _("\
Set max number of complaints about incorrect symbols."), _("\
Show max number of complaints about incorrect symbols."), NULL,
- fprint_setshow_complaints,
- NULL, NULL,
+ NULL, /* IGNORE */
+ NULL, complaints_show_value,
&setlist, &showlist);
-
}
Index: mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.374
diff -p -u -r1.374 mips-tdep.c
--- mips-tdep.c 15 Feb 2005 15:49:13 -0000 1.374
+++ mips-tdep.c 16 Feb 2005 17:19:16 -0000
@@ -761,9 +761,12 @@ mips_mask_address_p (struct gdbarch_tdep
}
static void
-show_mask_address (char *cmd, int from_tty, struct cmd_list_element *c)
+show_mask_address (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c, const char *value)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+
+ deprecated_show_value_hack (file, from_tty, c, value);
switch (mask_address_var)
{
case AUTO_BOOLEAN_TRUE:
@@ -5266,7 +5269,8 @@ Show zeroing of upper 32 bits of 64-bit
Use \"on\" to enable the masking, \"off\" to disable it and \"auto\" to \n\
allow GDB to determine the correct value."),
NULL, /* FIXME: i18n: Zerroing of upper 32 bits of 64-bit address is %s. */
- NULL, show_mask_address, &setmipscmdlist, &showmipscmdlist);
+ NULL, show_mask_address,
+ &setmipscmdlist, &showmipscmdlist);
/* Allow the user to control the size of 32 bit registers within the
raw remote packet. */
Index: remote.c
===================================================================
RCS file: /cvs/src/src/gdb/remote.c,v
retrieving revision 1.170
diff -p -u -r1.170 remote.c
--- remote.c 15 Feb 2005 15:49:18 -0000 1.170
+++ remote.c 16 Feb 2005 17:19:16 -0000
@@ -634,7 +634,7 @@ add_packet_config_cmd (struct packet_con
char *name,
char *title,
cmd_sfunc_ftype *set_func,
- cmd_sfunc_ftype *show_func,
+ show_value_ftype *show_func,
struct cmd_list_element **set_remote_list,
struct cmd_list_element **show_remote_list,
int legacy)
@@ -750,9 +750,11 @@ set_remote_protocol_vcont_packet_cmd (ch
}
static void
-show_remote_protocol_vcont_packet_cmd (char *args, int from_tty,
- struct cmd_list_element *c)
+show_remote_protocol_vcont_packet_cmd (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c,
+ const char *value)
{
+ deprecated_show_value_hack (file, from_tty, c, value);
show_packet_config_cmd (&remote_protocol_vcont);
}
@@ -767,9 +769,11 @@ set_remote_protocol_qSymbol_packet_cmd (
}
static void
-show_remote_protocol_qSymbol_packet_cmd (char *args, int from_tty,
- struct cmd_list_element *c)
+show_remote_protocol_qSymbol_packet_cmd (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c,
+ const char *value)
{
+ deprecated_show_value_hack (file, from_tty, c, value);
show_packet_config_cmd (&remote_protocol_qSymbol);
}
@@ -785,9 +789,11 @@ set_remote_protocol_P_packet_cmd (char *
}
static void
-show_remote_protocol_P_packet_cmd (char *args, int from_tty,
- struct cmd_list_element *c)
+show_remote_protocol_P_packet_cmd (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c,
+ const char *value)
{
+ deprecated_show_value_hack (file, from_tty, c, value);
show_packet_config_cmd (&remote_protocol_P);
}
@@ -816,9 +822,11 @@ set_remote_protocol_Z_software_bp_packet
}
static void
-show_remote_protocol_Z_software_bp_packet_cmd (char *args, int from_tty,
- struct cmd_list_element *c)
+show_remote_protocol_Z_software_bp_packet_cmd (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c,
+ const char *value)
{
+ deprecated_show_value_hack (file, from_tty, c, value);
show_packet_config_cmd (&remote_protocol_Z[Z_PACKET_SOFTWARE_BP]);
}
@@ -830,9 +838,11 @@ set_remote_protocol_Z_hardware_bp_packet
}
static void
-show_remote_protocol_Z_hardware_bp_packet_cmd (char *args, int from_tty,
- struct cmd_list_element *c)
+show_remote_protocol_Z_hardware_bp_packet_cmd (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c,
+ const char *value)
{
+ deprecated_show_value_hack (file, from_tty, c, value);
show_packet_config_cmd (&remote_protocol_Z[Z_PACKET_HARDWARE_BP]);
}
@@ -844,9 +854,11 @@ set_remote_protocol_Z_write_wp_packet_cm
}
static void
-show_remote_protocol_Z_write_wp_packet_cmd (char *args, int from_tty,
- struct cmd_list_element *c)
+show_remote_protocol_Z_write_wp_packet_cmd (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c,
+ const char *value)
{
+ deprecated_show_value_hack (file, from_tty, c, value);
show_packet_config_cmd (&remote_protocol_Z[Z_PACKET_WRITE_WP]);
}
@@ -858,9 +870,11 @@ set_remote_protocol_Z_read_wp_packet_cmd
}
static void
-show_remote_protocol_Z_read_wp_packet_cmd (char *args, int from_tty,
- struct cmd_list_element *c)
+show_remote_protocol_Z_read_wp_packet_cmd (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c,
+ const char *value)
{
+ deprecated_show_value_hack (file, from_tty, c, value);
show_packet_config_cmd (&remote_protocol_Z[Z_PACKET_READ_WP]);
}
@@ -872,9 +886,11 @@ set_remote_protocol_Z_access_wp_packet_c
}
static void
-show_remote_protocol_Z_access_wp_packet_cmd (char *args, int from_tty,
- struct cmd_list_element *c)
+show_remote_protocol_Z_access_wp_packet_cmd (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c,
+ const char *value)
{
+ deprecated_show_value_hack (file, from_tty, c, value);
show_packet_config_cmd (&remote_protocol_Z[Z_PACKET_ACCESS_WP]);
}
@@ -896,8 +912,9 @@ set_remote_protocol_Z_packet_cmd (char *
}
static void
-show_remote_protocol_Z_packet_cmd (char *args, int from_tty,
- struct cmd_list_element *c)
+show_remote_protocol_Z_packet_cmd (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c,
+ const char *value)
{
int i;
for (i = 0; i < NR_Z_PACKET_TYPES; i++)
@@ -938,9 +955,11 @@ set_remote_protocol_binary_download_cmd
}
static void
-show_remote_protocol_binary_download_cmd (char *args, int from_tty,
- struct cmd_list_element *c)
+show_remote_protocol_binary_download_cmd (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c,
+ const char *value)
{
+ deprecated_show_value_hack (file, from_tty, c, value);
show_packet_config_cmd (&remote_protocol_binary_download);
}
@@ -955,9 +974,11 @@ set_remote_protocol_qPart_auxv_packet_cm
}
static void
-show_remote_protocol_qPart_auxv_packet_cmd (char *args, int from_tty,
- struct cmd_list_element *c)
+show_remote_protocol_qPart_auxv_packet_cmd (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c,
+ const char *value)
{
+ deprecated_show_value_hack (file, from_tty, c, value);
show_packet_config_cmd (&remote_protocol_qPart_auxv);
}
@@ -971,9 +992,11 @@ set_remote_protocol_p_packet_cmd (char *
}
static void
-show_remote_protocol_p_packet_cmd (char *args, int from_tty,
- struct cmd_list_element *c)
+show_remote_protocol_p_packet_cmd (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c,
+ const char *value)
{
+ deprecated_show_value_hack (file, from_tty, c, value);
show_packet_config_cmd (&remote_protocol_p);
}
@@ -5500,13 +5523,13 @@ show_remote_cmd (char *args, int from_tt
{
/* FIXME: cagney/2002-06-15: This function should iterate over
remote_show_cmdlist for a list of sub commands to show. */
- show_remote_protocol_Z_packet_cmd (args, from_tty, NULL);
- show_remote_protocol_P_packet_cmd (args, from_tty, NULL);
- show_remote_protocol_p_packet_cmd (args, from_tty, NULL);
- show_remote_protocol_qSymbol_packet_cmd (args, from_tty, NULL);
- show_remote_protocol_vcont_packet_cmd (args, from_tty, NULL);
- show_remote_protocol_binary_download_cmd (args, from_tty, NULL);
- show_remote_protocol_qPart_auxv_packet_cmd (args, from_tty, NULL);
+ show_remote_protocol_Z_packet_cmd (gdb_stdout, from_tty, NULL, NULL);
+ show_remote_protocol_P_packet_cmd (gdb_stdout, from_tty, NULL, NULL);
+ show_remote_protocol_p_packet_cmd (gdb_stdout, from_tty, NULL, NULL);
+ show_remote_protocol_qSymbol_packet_cmd (gdb_stdout, from_tty, NULL, NULL);
+ show_remote_protocol_vcont_packet_cmd (gdb_stdout, from_tty, NULL, NULL);
+ show_remote_protocol_binary_download_cmd (gdb_stdout, from_tty, NULL, NULL);
+ show_remote_protocol_qPart_auxv_packet_cmd (gdb_stdout, from_tty, NULL, NULL);
}
static void
Index: cli/cli-decode.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-decode.c,v
retrieving revision 1.46
diff -p -u -r1.46 cli-decode.c
--- cli/cli-decode.c 11 Feb 2005 04:06:10 -0000 1.46
+++ cli/cli-decode.c 16 Feb 2005 17:19:16 -0000
@@ -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, enu
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, en
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
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, en
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, en
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)
{
Index: cli/cli-decode.h
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-decode.h,v
retrieving revision 1.20
diff -p -u -r1.20 cli-decode.h
--- cli/cli-decode.h 10 Feb 2005 17:32:53 -0000 1.20
+++ cli/cli-decode.h 16 Feb 2005 17:19:16 -0000
@@ -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
Index: cli/cli-setshow.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-setshow.c,v
retrieving revision 1.20
diff -p -u -r1.20 cli-setshow.c
--- cli/cli-setshow.c 11 Feb 2005 18:13:55 -0000 1.20
+++ cli/cli-setshow.c 16 Feb 2005 17:19:16 -0000
@@ -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_
{
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_
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_
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_
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_
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);
}