aboutsummaryrefslogtreecommitdiff
path: root/gdb/cli
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2005-02-10 17:32:53 +0000
committerAndrew Cagney <cagney@redhat.com>2005-02-10 17:32:53 +0000
commit335cca0d6ecc363f7fd22244823deb8e2a657088 (patch)
tree1968b155ea79f7fc0a41be3f793b55df982a42fa /gdb/cli
parent899506a887012d40285dfbadfe6991442d1aead9 (diff)
downloadbinutils-335cca0d6ecc363f7fd22244823deb8e2a657088.zip
binutils-335cca0d6ecc363f7fd22244823deb8e2a657088.tar.gz
binutils-335cca0d6ecc363f7fd22244823deb8e2a657088.tar.bz2
2005-02-10 Andrew Cagney <cagney@gnu.org>
* cli/cli-decode.c (add_setshow_enum_cmd, add_setshow_cmd_full) (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): Replace print string parameter with fprint_setshow function. * command.h (fprint_setshow_ftype): Define. Update declarations. * cli/cli-setshow.c (do_setshow_command): When fprint_setshow is available, use that. * cli/cli-decode.h (struct cmd_list_element): Add field fprint_setshow. * complaints.c (fprint_setshow_complaints): New function. (_initialize_complaints): Pass to add_setshow_zinteger_cmd. * hppa-tdep.c (_initialize_hppa_tdep): Replace "print" parameter with NULL. * mips-tdep.c (_initialize_mips_tdep): Ditto. * m32r-rom.c (_initialize_m32r_rom): Ditto. * cris-tdep.c (_initialize_cris_tdep): Ditto. * arm-tdep.c (_initialize_arm_tdep): Ditto. * remote-rdi.c (_initialize_remote_rdi): Ditto. * alpha-tdep.c (_initialize_alpha_tdep): Ditto. * dwarf2read.c (_initialize_dwarf2_read): Ditto. * frame.c (_initialize_frame): Ditto. * target.c (initialize_targets): Ditto. * maint.c (_initialize_maint_cmds): Ditto. * observer.c (_initialize_observer): Ditto. * infcall.c (_initialize_infcall): Ditto. * breakpoint.c (_initialize_breakpoint): Ditto. * cli/cli-logging.c (_initialize_cli_logging): Ditto. * remote.c (add_packet_config_cmd, _initialize_remote): Ditto.
Diffstat (limited to 'gdb/cli')
-rw-r--r--gdb/cli/cli-decode.c40
-rw-r--r--gdb/cli/cli-decode.h4
-rw-r--r--gdb/cli/cli-logging.c12
-rw-r--r--gdb/cli/cli-setshow.c8
4 files changed, 43 insertions, 21 deletions
diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index 1e91572..40d5cd6 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -330,7 +330,8 @@ add_setshow_cmd_full (char *name,
enum command_class class,
var_types var_type, void *var,
const char *set_doc, const char *show_doc,
- const char *help_doc, const char *print,
+ const char *help_doc,
+ fprint_setshow_ftype *fprint_setshow,
cmd_sfunc_ftype *set_func,
cmd_sfunc_ftype *show_func,
struct cmd_list_element **set_list,
@@ -359,6 +360,8 @@ 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);
@@ -415,7 +418,7 @@ add_setshow_enum_cmd (char *name,
const char *set_doc,
const char *show_doc,
const char *help_doc,
- const char *print,
+ fprint_setshow_ftype *fprint_setshow,
cmd_sfunc_ftype *set_func,
cmd_sfunc_ftype *show_func,
struct cmd_list_element **set_list,
@@ -423,7 +426,8 @@ add_setshow_enum_cmd (char *name,
{
struct cmd_list_element *c;
add_setshow_cmd_full (name, class, var_enum, var,
- set_doc, show_doc, help_doc, print,
+ set_doc, show_doc, help_doc,
+ fprint_setshow,
set_func, show_func,
set_list, show_list,
&c, NULL);
@@ -439,7 +443,8 @@ add_setshow_auto_boolean_cmd (char *name,
enum command_class class,
enum auto_boolean *var,
const char *set_doc, const char *show_doc,
- const char *help_doc, const char *print,
+ const char *help_doc,
+ fprint_setshow_ftype *fprint_setshow,
cmd_sfunc_ftype *set_func,
cmd_sfunc_ftype *show_func,
struct cmd_list_element **set_list,
@@ -448,7 +453,7 @@ add_setshow_auto_boolean_cmd (char *name,
static const char *auto_boolean_enums[] = { "on", "off", "auto", NULL };
struct cmd_list_element *c;
add_setshow_cmd_full (name, class, var_auto_boolean, var,
- set_doc, show_doc, help_doc, print,
+ set_doc, show_doc, help_doc, fprint_setshow,
set_func, show_func,
set_list, show_list,
&c, NULL);
@@ -462,7 +467,8 @@ add_setshow_auto_boolean_cmd (char *name,
void
add_setshow_boolean_cmd (char *name, enum command_class class, int *var,
const char *set_doc, const char *show_doc,
- const char *help_doc, const char *print,
+ const char *help_doc,
+ fprint_setshow_ftype *fprint_setshow,
cmd_sfunc_ftype *set_func,
cmd_sfunc_ftype *show_func,
struct cmd_list_element **set_list,
@@ -471,7 +477,7 @@ add_setshow_boolean_cmd (char *name, enum command_class class, int *var,
static const char *boolean_enums[] = { "on", "off", NULL };
struct cmd_list_element *c;
add_setshow_cmd_full (name, class, var_boolean, var,
- set_doc, show_doc, help_doc, print,
+ set_doc, show_doc, help_doc, fprint_setshow,
set_func, show_func,
set_list, show_list,
&c, NULL);
@@ -484,14 +490,15 @@ void
add_setshow_filename_cmd (char *name, enum command_class class,
char **var,
const char *set_doc, const char *show_doc,
- const char *help_doc, const char *print,
+ const char *help_doc,
+ fprint_setshow_ftype *fprint_setshow,
cmd_sfunc_ftype *set_func,
cmd_sfunc_ftype *show_func,
struct cmd_list_element **set_list,
struct cmd_list_element **show_list)
{
add_setshow_cmd_full (name, class, var_filename, var,
- set_doc, show_doc, help_doc, print,
+ set_doc, show_doc, help_doc, fprint_setshow,
set_func, show_func,
set_list, show_list,
NULL, NULL);
@@ -503,14 +510,15 @@ void
add_setshow_string_cmd (char *name, enum command_class class,
char **var,
const char *set_doc, const char *show_doc,
- const char *help_doc, const char *print,
+ const char *help_doc,
+ fprint_setshow_ftype *fprint_setshow,
cmd_sfunc_ftype *set_func,
cmd_sfunc_ftype *show_func,
struct cmd_list_element **set_list,
struct cmd_list_element **show_list)
{
add_setshow_cmd_full (name, class, var_string, var,
- set_doc, show_doc, help_doc, print,
+ set_doc, show_doc, help_doc, fprint_setshow,
set_func, show_func,
set_list, show_list,
NULL, NULL);
@@ -524,14 +532,15 @@ void
add_setshow_uinteger_cmd (char *name, enum command_class class,
unsigned int *var,
const char *set_doc, const char *show_doc,
- const char *help_doc, const char *print,
+ const char *help_doc,
+ fprint_setshow_ftype *fprint_setshow,
cmd_sfunc_ftype *set_func,
cmd_sfunc_ftype *show_func,
struct cmd_list_element **set_list,
struct cmd_list_element **show_list)
{
add_setshow_cmd_full (name, class, var_uinteger, var,
- set_doc, show_doc, help_doc, print,
+ set_doc, show_doc, help_doc, fprint_setshow,
set_func, show_func,
set_list, show_list,
NULL, NULL);
@@ -545,14 +554,15 @@ void
add_setshow_zinteger_cmd (char *name, enum command_class class,
int *var,
const char *set_doc, const char *show_doc,
- const char *help_doc, const char *print,
+ const char *help_doc,
+ fprint_setshow_ftype *fprint_setshow,
cmd_sfunc_ftype *set_func,
cmd_sfunc_ftype *show_func,
struct cmd_list_element **set_list,
struct cmd_list_element **show_list)
{
add_setshow_cmd_full (name, class, var_zinteger, var,
- set_doc, show_doc, help_doc, print,
+ set_doc, show_doc, help_doc, fprint_setshow,
set_func, show_func,
set_list, show_list,
NULL, NULL);
diff --git a/gdb/cli/cli-decode.h b/gdb/cli/cli-decode.h
index 15732af..d00ff09 100644
--- a/gdb/cli/cli-decode.h
+++ b/gdb/cli/cli-decode.h
@@ -88,6 +88,10 @@ struct cmd_list_element
Entire string should also end with a period, not a newline. */
char *doc;
+ /* For set/show commands. A method for printing the output to the
+ specified stream. */
+ fprint_setshow_ftype *fprint_setshow;
+
/* flags : a bitfield
bit 0: (LSB) CMD_DEPRECATED, when 1 indicated that this command
diff --git a/gdb/cli/cli-logging.c b/gdb/cli/cli-logging.c
index 6b32b33..773a420 100644
--- a/gdb/cli/cli-logging.c
+++ b/gdb/cli/cli-logging.c
@@ -177,21 +177,21 @@ _initialize_cli_logging (void)
add_setshow_boolean_cmd ("overwrite", class_support, &logging_overwrite, "\
Set whether logging overwrites or appends to the log file.", "\
Show whether logging overwrites or appends to the log file.", "\
-If set, logging overrides the log file.", "\
-Whether logging overwrites or appends to the log file is %s.",
+If set, logging overrides the log file.",
+ NULL, /* PRINT: Whether logging overwrites or appends to the log file is %s. */
NULL, NULL, &set_logging_cmdlist, &show_logging_cmdlist);
add_setshow_boolean_cmd ("redirect", class_support, &logging_redirect, "\
Set the logging output mode.", "\
Show the logging output mode.", "\
If redirect is off, output will go to both the screen and the log file.\n\
-If redirect is on, output will go only to the log file.", "\
-The logging output mode is %s.",
+If redirect is on, output will go only to the log file.",
+ NULL, /* PRINT: The logging output mode is %s. */
NULL, NULL, &set_logging_cmdlist, &show_logging_cmdlist);
add_setshow_filename_cmd ("file", class_support, &logging_filename, "\
Set the current logfile.", "\
Show the current logfile.", "\
-The logfile is used when directing GDB's output.", "\
-The current logfile is %s.",
+The logfile is used when directing GDB's output.",
+ NULL, /* PRINT: The current logfile is %s. */
NULL, NULL,
&set_logging_cmdlist, &show_logging_cmdlist);
add_cmd ("on", class_support, set_logging_on,
diff --git a/gdb/cli/cli-setshow.c b/gdb/cli/cli-setshow.c
index 73e47a4..8f84345a 100644
--- a/gdb/cli/cli-setshow.c
+++ b/gdb/cli/cli-setshow.c
@@ -337,6 +337,14 @@ 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)
+ {
+ 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. */