This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Patch for PR cli/877
- From: Nat Gurumoorthy <natg at ubicom dot com>
- To: gdb-patches at sources dot redhat dot com
- Date: Tue, 10 Dec 2002 12:42:49 -0800
- Subject: Patch for PR cli/877
This is patch for PR cli/877. When the user types q to quit
during output from "info set" command the ui_out_tuple_end does not
get called which leaves the uiout->level undecremented. The correct way
to do this is to call "make_cleanup_ui_out_tuple_begin_end" instead of
ui_out_tuple_begin. Call "do_cleanups" instead of ui_out_tuple_end to
do the uiout->level fixup.
Regards
Nat
gdb/Changelog
2002-12-10 Nat Gurumoorthy <nat.gurumoorthy@ubicom.com>
* cli/cli-setshow.c: cmd_show_list function use
make_cleanup_ui_out_tuple_begin_end and do_cleanups instead
of ui_out_tuple_begin and ui_out_tuple_end.
Index: cli-setshow.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-setshow.c,v
retrieving revision 1.11
diff -c -r1.11 cli-setshow.c
*** cli-setshow.c 10 Dec 2002 00:30:43 -0000 1.11
--- cli-setshow.c 10 Dec 2002 20:11:57 -0000
***************
*** 353,380 ****
void
cmd_show_list (struct cmd_list_element *list, int from_tty, char *prefix)
{
! ui_out_tuple_begin (uiout, "showlist");
for (; list != NULL; list = list->next)
{
/* If we find a prefix, run its list, prefixing our output by its
prefix (with "show " skipped). */
if (list->prefixlist && !list->abbrev_flag)
{
! ui_out_tuple_begin (uiout, "optionlist");
ui_out_field_string (uiout, "prefix", list->prefixname + 5);
cmd_show_list (*list->prefixlist, from_tty, list->prefixname + 5);
! ui_out_tuple_end (uiout);
}
if (list->type == show_cmd)
{
! ui_out_tuple_begin (uiout, "option");
ui_out_text (uiout, prefix);
ui_out_field_string (uiout, "name", list->name);
ui_out_text (uiout, ": ");
do_setshow_command ((char *) NULL, from_tty, list);
! ui_out_tuple_end (uiout);
}
}
! ui_out_tuple_end (uiout);
}
-
--- 353,379 ----
void
cmd_show_list (struct cmd_list_element *list, int from_tty, char *prefix)
{
! struct cleanup *old_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "showlist");
for (; list != NULL; list = list->next)
{
/* If we find a prefix, run its list, prefixing our output by its
prefix (with "show " skipped). */
if (list->prefixlist && !list->abbrev_flag)
{
! struct cleanup *old_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "optionlist");
ui_out_field_string (uiout, "prefix", list->prefixname + 5);
cmd_show_list (*list->prefixlist, from_tty, list->prefixname + 5);
! do_cleanups(old_chain);
}
if (list->type == show_cmd)
{
! struct cleanup *old_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "option");
ui_out_text (uiout, prefix);
ui_out_field_string (uiout, "name", list->name);
ui_out_text (uiout, ": ");
do_setshow_command ((char *) NULL, from_tty, list);
! do_cleanups(old_chain);
}
}
! do_cleanups(old_chain);
}