From: Kevin Buettner <kevinb@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: [PATCH RFC] Use ui_out cleanups in cli-setshow.c
Date: Thu, 25 Jul 2002 12:57:00 -0000 [thread overview]
Message-ID: <1020725195150.ZM11780@localhost.localdomain> (raw)
I've been seeing the following assertion failure in gdb:
../../src/gdb/ui-out.c:130: gdb-internal-error: push_level: Assertion
`uiout->level >= 0 && uiout->level < MAX_UI_OUT_LEVELS' failed.
A simple way to generate this is to run the ``info set'' command. A
rather long list is generated; when the "---Type <return> to continue,
or q <return> to quit---" prompt comes up, hit "q <return>". Then
run the ``info set'' command again to see the assertion failure.
The reason that this happens is we're a couple of levels in in the
global uiout and returning to the top level doesn't pop the levels
correctly.
The patch below fixes cmd_show_list(), but I think there are many
other places in gdb that'll need similar fixes. Basically, we have
to replace all calls to ui_out_tuple_begin with calls to
make_cleanup_ui_out_tuple_begin_end. Then, later on, instead of
invoking ui_out_tuple_end, we'll instead invoke do_cleanups with the
cleanup chain generated from the earlier make_cleanup_... call.
If this really is the case, I can't help but think that there's a better
way to structure the code. Opinions?
* cli/cli-setshow.c (cmd_show_list): Use cleanups to invoke
ui_out_tuple_end().
Index: cli/cli-setshow.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-setshow.c,v
retrieving revision 1.8
diff -u -p -r1.8 cli-setshow.c
--- cli/cli-setshow.c 15 Jun 2002 18:45:32 -0000 1.8
+++ cli/cli-setshow.c 25 Jul 2002 19:22:02 -0000
@@ -354,28 +354,35 @@ do_setshow_command (char *arg, int from_
void
cmd_show_list (struct cmd_list_element *list, int from_tty, char *prefix)
{
- ui_out_tuple_begin (uiout, "showlist");
+ struct cleanup *showlist_chain;
+
+ showlist_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)
{
- ui_out_tuple_begin (uiout, "optionlist");
+ struct cleanup *optionlist_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);
- ui_out_tuple_end (uiout);
+ /* Invoke ui_out_tuple_end (uiout). */
+ do_cleanups (optionlist_chain);
}
if (list->type == show_cmd)
{
- ui_out_tuple_begin (uiout, "option");
+ struct cleanup *option_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);
- ui_out_tuple_end (uiout);
+ /* Invoke ui_out_tuple_end (uiout). */
+ do_cleanups (option_chain);
}
}
- ui_out_tuple_end (uiout);
+ /* Invoke ui_out_tuple_end (uiout). */
+ do_cleanups (showlist_chain);
}
reply other threads:[~2002-07-25 19:51 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1020725195150.ZM11780@localhost.localdomain \
--to=kevinb@redhat.com \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox