This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
I think it is too big for a single patch - I'm seeing a number of things that might need a comment/question and that is causing an internal overflow :-(This patch changes gdb to use add_setshow_cmd everywhere it used to use add_show_from_set. This patch actually consists of several different parts. I couldn't think of a simple way to separate the parts that didn't involve a lot of redundant work on my part. I've already done several passes over the source; the thought of more is unpalatable. Though more are in my future :-( * Add a new `print doc' argument to add_setshow_cmd. This is used to format the `show foo' output * Add a corresponding field to struct cmd_list_element * Update test suite to reflect (minor) changes to gdb's output * Removed set_verbose function. It was easier to remove than to fix, and anyway the joke is stale now. * Added add_setshow_enum_cmd, updated all callers * Added argument to add_setshow_auto_boolean_cmd and add_setshow_boolean_cmd. This is the `print doc' argument as with add_setshow_cmd. Updated all callers. In some of the appended, all the strings in a given file are marked. I can try to back out that part of the patch if you'd prefer to review those changes separately. This runs the gdb test suite on my box (x86 Red Hat Linux 7.3) with no regressions. It also compiles with -Werror enabled. I've only built the native configuration. Once this goes in my plan is to remove add_show_from_set entirely. Comments? Critiques? Questions? Ok to commit?
can be isolated and once that is done the rest becomes incremental. Looking at this specific change I see:* Add a new `print doc' argument to add_setshow_cmd. This is used to format the `show foo' output
Index: cli/cli-setshow.cCan this be written using:
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-setshow.c,v
retrieving revision 1.8
diff -u -r1.8 cli-setshow.c
--- cli/cli-setshow.c 15 Jun 2002 18:45:32 -0000 1.8
+++ cli/cli-setshow.c 1 Jul 2002 18:24:47 -0000
@@ -258,7 +258,8 @@
{
struct cleanup *old_chain;
struct ui_stream *stb;
- int quote;
+ int quote, len;
+ char *text, *ps, *tem;
stb = ui_out_stream_new (uiout);
old_chain = make_cleanup_ui_out_stream_delete (stb);
@@ -267,11 +268,23 @@
if (c->pre_show_hook)
(c->pre_show_hook) (c);
- /* Print doc minus "show" at start. */
- print_doc_line (gdb_stdout, c->doc + 5);
+ /* Translate and print the `show' string. We deal with the `%s'
+ by hand to simplify some of the processing -- this way we
+ don't have to figure out how to allocate a temporary buffer. */
+ text = gettext (c->print_doc);
+ ps = strstr (text, "%s");
+ len = strlen (text);
+ if (! ps)
+ internal_error (__FILE__, __LINE__,
+ "do_setshow_command: invalid translation");
+ if (ps - text > len)
+ len = ps - text;
+ tem = xmalloc (len + 1);
+ strncpy (tem, text, ps - text);
+ tem[ps - text] = '\0';
+
+ ui_out_text (uiout, tem);
- ui_out_text (uiout, " is ");
- ui_out_wrap_hint (uiout, " ");
quote = 0;
switch (c->var_type)
{
@@ -339,7 +352,13 @@
ui_out_field_stream (uiout, "value", stb);
if (quote)
ui_out_text (uiout, "\"");
- ui_out_text (uiout, ".\n");
+
+ strcpy (tem, ps + 2);
+ ui_out_text (uiout, tem);
+ xfree (tem);
+
+ ui_out_text (uiout, "\n");
+
do_cleanups (old_chain);
}
else
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |