This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[commit] Reorg do_setshow_command's output
- From: Andrew Cagney <cagney at gnu dot org>
- To: gdb-patches at sources dot redhat dot com
- Date: Thu, 10 Feb 2005 10:26:27 -0500
- Subject: [commit] Reorg do_setshow_command's output
FYI,
This moves all the print code found in do_setshow to a single location.
Next is to re-org things so that print string being passed to
add_setshow_..._cmd is actually used.
Andrew
2005-02-10 Andrew Cagney <cagney@gnu.org>
* cli/cli-setshow.c (do_setshow_command): Move code printing the
value to the end of the function. Handle MI and non-MI output
differently.
Index: cli/cli-setshow.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-setshow.c,v
retrieving revision 1.16
diff -p -u -r1.16 cli-setshow.c
--- cli/cli-setshow.c 10 May 2004 18:17:25 -0000 1.16
+++ cli/cli-setshow.c 10 Feb 2005 15:22:52 -0000
@@ -266,11 +266,6 @@ do_setshow_command (char *arg, int from_
if (c->pre_show_hook)
(c->pre_show_hook) (c);
- /* Print doc minus "show" at start. */
- print_doc_line (gdb_stdout, c->doc + 5);
-
- ui_out_text (uiout, " is ");
- ui_out_wrap_hint (uiout, " ");
quote = 0;
switch (c->var_type)
{
@@ -333,12 +328,30 @@ do_setshow_command (char *arg, int from_
default:
error ("gdb internal error: bad var_type in do_setshow_command");
}
- if (quote)
- ui_out_text (uiout, "\"");
- ui_out_field_stream (uiout, "value", stb);
- if (quote)
- ui_out_text (uiout, "\"");
- ui_out_text (uiout, ".\n");
+
+
+ /* FIXME: cagney/2005-02-10: Need to split this in half: code to
+ convert the value into a string (esentially the above); and
+ code to print the value out. For the latter there should be
+ MI and CLI specific versions. */
+
+ if (ui_out_is_mi_like_p (uiout))
+ ui_out_field_stream (uiout, "value", stb);
+ 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);
+ }
do_cleanups (old_chain);
}
else