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]

[PATCH] old ui_out_tuple_begin_end patch


Gdb still gets random errors from failing the assertions in ui-out.c
about the MAX_UI_OUT_LEVELS being reached.

I have found these old patches from Kevin that cleaned up a few
things.  I cleaned up a few more things, so now there is no use left
of ui_out_tuple_begin, etc.  I am going to commit them tomorrow.


http://sources.redhat.com/ml/gdb-patches/2002-07/msg00514.html
http://sources.redhat.com/ml/gdb-patches/2002-07/msg00517.html

Elena


2003-01-31  Elena Zannoni  <ezannoni@redhat.com>

	* disasm.c (dump_insns): Use make_cleanup_ui_out_tuple_begin_end.
	(do_mixed_source_and_assembly): Use
	make_cleanup_ui_out_tuple_begin_end and
	make_cleanup_ui_out_tuple_begin_end.
	(do_mixed_source_and_assembly): Ditto.
	* thread.c (do_captured_list_thread_ids): Ditto.
	* ui-out.h (ui_out_table_begin, ui_out_list_begin,
	ui_out_tuple_begin, ui_out_table_end, ui_out_list_end,
	ui_out_tuple_end): Delete prototypes.
	* ui-out.c (ui_out_list_begin, ui_out_tuple_begin,
	ui_out_list_end, ui_out_tuple_end): Delete.

	From Kevin Buettner  <kevinb@redhat.com>:
	* ui-out.h (make_cleanup_ui_out_table_begin_end): New function.
        * ui-out.c (make_cleanup_ui_out_table_begin_end)
        (do_cleanup_table_end):  New functions.
        * breakpoint.c (print_it_typical, print_one_breakpoint, mention):
        Use cleanups to invoke_ui_out_tuple_end().
        (breakpoint_1): Use cleanup to invoke ui_out_table_end().
	* cli/cli-setshow.c (cmd_show_list): Use
	make_cleanup_ui_out_tuple_begin_end.

Index: breakpoint.c
===================================================================
RCS file: /cvs/uberbaum/gdb/breakpoint.c,v
retrieving revision 1.107
diff -u -p -r1.107 breakpoint.c
--- breakpoint.c	18 Jan 2003 15:55:51 -0000	1.107
+++ breakpoint.c	31 Jan 2003 23:57:37 -0000
@@ -2002,7 +2002,7 @@ top:
 static enum print_stop_action
 print_it_typical (bpstat bs)
 {
-  struct cleanup *old_chain;
+  struct cleanup *old_chain, *ui_out_chain;
   struct ui_stream *stb;
   stb = ui_out_stream_new (uiout);
   old_chain = make_cleanup_ui_out_stream_delete (stb);
@@ -2163,14 +2163,14 @@ print_it_typical (bpstat bs)
 	  if (ui_out_is_mi_like_p (uiout))
 	    ui_out_field_string (uiout, "reason", "watchpoint-trigger");
 	  mention (bs->breakpoint_at);
-	  ui_out_tuple_begin (uiout, "value");
+	  ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "value");
 	  ui_out_text (uiout, "\nOld value = ");
 	  value_print (bs->old_val, stb->stream, 0, Val_pretty_default);
 	  ui_out_field_stream (uiout, "old", stb);
 	  ui_out_text (uiout, "\nNew value = ");
 	  value_print (bs->breakpoint_at->val, stb->stream, 0, Val_pretty_default);
 	  ui_out_field_stream (uiout, "new", stb);
-	  ui_out_tuple_end (uiout);
+	  do_cleanups (ui_out_chain);
 	  ui_out_text (uiout, "\n");
 	  value_free (bs->old_val);
 	  bs->old_val = NULL;
@@ -2183,11 +2183,11 @@ print_it_typical (bpstat bs)
       if (ui_out_is_mi_like_p (uiout))
 	ui_out_field_string (uiout, "reason", "read-watchpoint-trigger");
       mention (bs->breakpoint_at);
-      ui_out_tuple_begin (uiout, "value");
+      ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "value");
       ui_out_text (uiout, "\nValue = ");
       value_print (bs->breakpoint_at->val, stb->stream, 0, Val_pretty_default);
       ui_out_field_stream (uiout, "value", stb);
-      ui_out_tuple_end (uiout);
+      do_cleanups (ui_out_chain);
       ui_out_text (uiout, "\n");
       return PRINT_UNKNOWN;
       break;
@@ -2199,7 +2199,7 @@ print_it_typical (bpstat bs)
 	  if (ui_out_is_mi_like_p (uiout))
 	    ui_out_field_string (uiout, "reason", "access-watchpoint-trigger");
 	  mention (bs->breakpoint_at);
-	  ui_out_tuple_begin (uiout, "value");
+	  ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "value");
 	  ui_out_text (uiout, "\nOld value = ");
 	  value_print (bs->old_val, stb->stream, 0, Val_pretty_default);
 	  ui_out_field_stream (uiout, "old", stb);
@@ -2212,12 +2212,12 @@ print_it_typical (bpstat bs)
 	  mention (bs->breakpoint_at);
 	  if (ui_out_is_mi_like_p (uiout))
 	    ui_out_field_string (uiout, "reason", "access-watchpoint-trigger");
-	  ui_out_tuple_begin (uiout, "value");
+	  ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "value");
 	  ui_out_text (uiout, "\nValue = ");
 	}
       value_print (bs->breakpoint_at->val, stb->stream, 0,Val_pretty_default);
       ui_out_field_stream (uiout, "new", stb);
-      ui_out_tuple_end (uiout);
+      do_cleanups (ui_out_chain);
       ui_out_text (uiout, "\n");
       return PRINT_UNKNOWN;
       break;
@@ -3229,9 +3229,10 @@ print_one_breakpoint (struct breakpoint 
   char wrap_indent[80];
   struct ui_stream *stb = ui_out_stream_new (uiout);
   struct cleanup *old_chain = make_cleanup_ui_out_stream_delete (stb);
+  struct cleanup *bkpt_chain;
 
   annotate_record ();
-  ui_out_tuple_begin (uiout, "bkpt");
+  bkpt_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "bkpt");
 
   /* 1 */
   annotate_field (0);
@@ -3469,12 +3470,14 @@ print_one_breakpoint (struct breakpoint 
   
   if ((l = b->commands))
     {
+      struct cleanup *script_chain;
+
       annotate_field (9);
-      ui_out_tuple_begin (uiout, "script");
+      script_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "script");
       print_command_lines (uiout, l, 4);
-      ui_out_tuple_end (uiout);
+      do_cleanups (script_chain);
     }
-  ui_out_tuple_end (uiout);
+  do_cleanups (bkpt_chain);
   do_cleanups (old_chain);
 }
 
@@ -3542,6 +3545,7 @@ breakpoint_1 (int bnum, int allflag)
   register struct breakpoint *b;
   CORE_ADDR last_addr = (CORE_ADDR) -1;
   int nr_printable_breakpoints;
+  struct cleanup *bkpttbl_chain;
   
   /* Compute the number of rows in the table. */
   nr_printable_breakpoints = 0;
@@ -3554,9 +3558,13 @@ breakpoint_1 (int bnum, int allflag)
       }
 
   if (addressprint)
-    ui_out_table_begin (uiout, 6, nr_printable_breakpoints, "BreakpointTable");
+    bkpttbl_chain 
+      = make_cleanup_ui_out_table_begin_end (uiout, 6, nr_printable_breakpoints,
+                                             "BreakpointTable");
   else
-    ui_out_table_begin (uiout, 5, nr_printable_breakpoints, "BreakpointTable");
+    bkpttbl_chain 
+      = make_cleanup_ui_out_table_begin_end (uiout, 5, nr_printable_breakpoints,
+                                             "BreakpointTable");
 
   if (nr_printable_breakpoints > 0)
     annotate_breakpoints_headers ();
@@ -3598,7 +3606,7 @@ breakpoint_1 (int bnum, int allflag)
 	  print_one_breakpoint (b, &last_addr);
       }
   
-  ui_out_table_end (uiout);
+  do_cleanups (bkpttbl_chain);
 
   if (nr_printable_breakpoints == 0)
     {
@@ -4390,7 +4398,7 @@ static void
 mention (struct breakpoint *b)
 {
   int say_where = 0;
-  struct cleanup *old_chain;
+  struct cleanup *old_chain, *ui_out_chain;
   struct ui_stream *stb;
 
   stb = ui_out_stream_new (uiout);
@@ -4412,39 +4420,39 @@ mention (struct breakpoint *b)
       break;
     case bp_watchpoint:
       ui_out_text (uiout, "Watchpoint ");
-      ui_out_tuple_begin (uiout, "wpt");
+      ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "wpt");
       ui_out_field_int (uiout, "number", b->number);
       ui_out_text (uiout, ": ");
       print_expression (b->exp, stb->stream);
       ui_out_field_stream (uiout, "exp", stb);
-      ui_out_tuple_end (uiout);
+      do_cleanups (ui_out_chain);
       break;
     case bp_hardware_watchpoint:
       ui_out_text (uiout, "Hardware watchpoint ");
-      ui_out_tuple_begin (uiout, "wpt");
+      ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "wpt");
       ui_out_field_int (uiout, "number", b->number);
       ui_out_text (uiout, ": ");
       print_expression (b->exp, stb->stream);
       ui_out_field_stream (uiout, "exp", stb);
-      ui_out_tuple_end (uiout);
+      do_cleanups (ui_out_chain);
       break;
     case bp_read_watchpoint:
       ui_out_text (uiout, "Hardware read watchpoint ");
-      ui_out_tuple_begin (uiout, "hw-rwpt");
+      ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "hw-rwpt");
       ui_out_field_int (uiout, "number", b->number);
       ui_out_text (uiout, ": ");
       print_expression (b->exp, stb->stream);
       ui_out_field_stream (uiout, "exp", stb);
-      ui_out_tuple_end (uiout);
+      do_cleanups (ui_out_chain);
       break;
     case bp_access_watchpoint:
       ui_out_text (uiout, "Hardware access (read/write) watchpoint ");
-      ui_out_tuple_begin (uiout, "hw-awpt");
+      ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "hw-awpt");
       ui_out_field_int (uiout, "number", b->number);
       ui_out_text (uiout, ": ");
       print_expression (b->exp, stb->stream);
       ui_out_field_stream (uiout, "exp", stb);
-      ui_out_tuple_end (uiout);
+      do_cleanups (ui_out_chain);
       break;
     case bp_breakpoint:
       if (ui_out_is_mi_like_p (uiout))

Index: disasm.c
===================================================================
RCS file: /cvs/uberbaum/gdb/disasm.c,v
retrieving revision 1.3
diff -u -p -r1.3 disasm.c
--- disasm.c	14 Jan 2003 00:49:03 -0000	1.3
+++ disasm.c	31 Jan 2003 23:58:46 -0000
@@ -97,6 +97,7 @@ dump_insns (struct ui_out *uiout, disass
   char *name = NULL;
   int offset;
   int line;
+  struct cleanup *ui_out_chain;
 
   for (pc = low; pc < high;)
     {
@@ -108,7 +109,7 @@ dump_insns (struct ui_out *uiout, disass
 	  else
 	    num_displayed++;
 	}
-      ui_out_tuple_begin (uiout, NULL);
+      ui_out_chain = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
       ui_out_field_core_addr (uiout, "address", pc);
 
       if (!build_address_symbolic (pc, 0, &name, &offset, &filename,
@@ -131,7 +132,7 @@ dump_insns (struct ui_out *uiout, disass
       pc += TARGET_PRINT_INSN (pc, di);
       ui_out_field_stream (uiout, "inst", stb);
       ui_file_rewind (stb->stream);
-      ui_out_tuple_end (uiout);
+      do_cleanups (ui_out_chain);
       ui_out_text (uiout, "\n");
     }
   return num_displayed;
@@ -157,6 +158,7 @@ do_mixed_source_and_assembly (struct ui_
   int next_line = 0;
   CORE_ADDR pc;
   int num_displayed = 0;
+  struct cleanup *ui_out_chain;
 
   mle = (struct dis_line_entry *) alloca (nlines
 					  * sizeof (struct dis_line_entry));
@@ -210,11 +212,14 @@ do_mixed_source_and_assembly (struct ui_
      they have been emitted before), followed by the assembly code
      for that line.  */
 
-  ui_out_list_begin (uiout, "asm_insns");
+  ui_out_chain = make_cleanup_ui_out_list_begin_end (uiout, "asm_insns");
 
   for (i = 0; i < newlines; i++)
     {
+      struct cleanup *ui_out_tuple_chain = NULL;
+      struct cleanup *ui_out_list_chain = NULL;
       int close_list = 1;
+      
       /* Print out everything from next_line to the current line.  */
       if (mle[i].line >= next_line)
 	{
@@ -223,7 +228,9 @@ do_mixed_source_and_assembly (struct ui_
 	      /* Just one line to print. */
 	      if (next_line == mle[i].line)
 		{
-		  ui_out_tuple_begin (uiout, "src_and_asm_line");
+		  ui_out_tuple_chain
+		    = make_cleanup_ui_out_tuple_begin_end (uiout,
+							   "src_and_asm_line");
 		  print_source_lines (symtab, next_line, mle[i].line + 1, 0);
 		}
 	      else
@@ -231,27 +238,38 @@ do_mixed_source_and_assembly (struct ui_
 		  /* Several source lines w/o asm instructions associated. */
 		  for (; next_line < mle[i].line; next_line++)
 		    {
-		      ui_out_tuple_begin (uiout, "src_and_asm_line");
+		      struct cleanup *ui_out_list_chain_line;
+		      struct cleanup *ui_out_tuple_chain_line;
+		      
+		      ui_out_tuple_chain_line
+			= make_cleanup_ui_out_tuple_begin_end (uiout,
+							       "src_and_asm_line");
 		      print_source_lines (symtab, next_line, next_line + 1,
 					  0);
-		      ui_out_list_begin (uiout, "line_asm_insn");
-		      ui_out_list_end (uiout);
-		      ui_out_tuple_end (uiout);
+		      ui_out_list_chain_line
+			= make_cleanup_ui_out_list_begin_end (uiout,
+							      "line_asm_insn");
+		      do_cleanups (ui_out_list_chain_line);
+		      do_cleanups (ui_out_tuple_chain_line);
 		    }
 		  /* Print the last line and leave list open for
 		     asm instructions to be added. */
-		  ui_out_tuple_begin (uiout, "src_and_asm_line");
+		  ui_out_tuple_chain
+		    = make_cleanup_ui_out_tuple_begin_end (uiout,
+							   "src_and_asm_line");
 		  print_source_lines (symtab, next_line, mle[i].line + 1, 0);
 		}
 	    }
 	  else
 	    {
-	      ui_out_tuple_begin (uiout, "src_and_asm_line");
+	      ui_out_tuple_chain
+		= make_cleanup_ui_out_tuple_begin_end (uiout, "src_and_asm_line");
 	      print_source_lines (symtab, mle[i].line, mle[i].line + 1, 0);
 	    }
 
 	  next_line = mle[i].line + 1;
-	  ui_out_list_begin (uiout, "line_asm_insn");
+	  ui_out_list_chain
+	    = make_cleanup_ui_out_list_begin_end (uiout, "line_asm_insn");
 	  /* Don't close the list if the lines are not in order. */
 	  if (i < (newlines - 1) && mle[i + 1].line <= mle[i].line)
 	    close_list = 0;
@@ -261,8 +279,8 @@ do_mixed_source_and_assembly (struct ui_
 				   how_many, stb);
       if (close_list)
 	{
-	  ui_out_list_end (uiout);
-	  ui_out_tuple_end (uiout);
+	  do_cleanups (ui_out_list_chain);
+	  do_cleanups (ui_out_tuple_chain);
 	  ui_out_text (uiout, "\n");
 	  close_list = 0;
 	}
@@ -270,7 +288,7 @@ do_mixed_source_and_assembly (struct ui_
 	if (num_displayed >= how_many)
 	  break;
     }
-  ui_out_list_end (uiout);
+  do_cleanups (ui_out_chain);
 }
 
 
@@ -280,12 +298,13 @@ do_assembly_only (struct ui_out *uiout, 
 		  int how_many, struct ui_stream *stb)
 {
   int num_displayed = 0;
+  struct cleanup *ui_out_chain;
 
-  ui_out_list_begin (uiout, "asm_insns");
+  ui_out_chain = make_cleanup_ui_out_list_begin_end (uiout, "asm_insns");
 
   num_displayed = dump_insns (uiout, di, low, high, how_many, stb);
 
-  ui_out_list_end (uiout);
+  do_cleanups (ui_out_chain);
 }
 
 void

Index: ui-out.c
===================================================================
RCS file: /cvs/uberbaum/gdb/ui-out.c,v
retrieving revision 1.25
diff -u -p -r1.25 ui-out.c
--- ui-out.c	15 Dec 2002 16:05:37 -0000	1.25
+++ ui-out.c	31 Jan 2003 23:59:44 -0000
@@ -273,7 +273,7 @@ static void init_ui_out_state (struct ui
 
 /* Mark beginning of a table */
 
-void
+static void
 ui_out_table_begin (struct ui_out *uiout, int nbrofcols,
 		    int nr_rows,
 		    const char *tblid)
@@ -318,7 +318,7 @@ columns.");
   uo_table_body (uiout);
 }
 
-void
+static void
 ui_out_table_end (struct ui_out *uiout)
 {
   if (!uiout->table.flag)
@@ -351,6 +351,22 @@ and before table_body.");
   uo_table_header (uiout, width, alignment, col_name, colhdr);
 }
 
+static void
+do_cleanup_table_end (void *data)
+{
+  struct ui_out *ui_out = data;
+
+  ui_out_table_end (ui_out);
+}
+
+struct cleanup *
+make_cleanup_ui_out_table_begin_end (struct ui_out *ui_out, int nr_cols,
+                                     int nr_rows, const char *tblid)
+{
+  ui_out_table_begin (ui_out, nr_cols, nr_rows, tblid);
+  return make_cleanup (do_cleanup_table_end, ui_out);
+}
+
 void
 ui_out_begin (struct ui_out *uiout,
 	      enum ui_out_type type,
@@ -388,19 +404,6 @@ specified after table_body.");
 }
 
 void
-ui_out_list_begin (struct ui_out *uiout,
-		   const char *id)
-{
-  ui_out_begin (uiout, ui_out_type_list, id);
-}
-
-void
-ui_out_tuple_begin (struct ui_out *uiout, const char *id)
-{
-  ui_out_begin (uiout, ui_out_type_tuple, id);
-}
-
-void
 ui_out_end (struct ui_out *uiout,
 	    enum ui_out_type type)
 {
@@ -408,18 +411,6 @@ ui_out_end (struct ui_out *uiout,
   uo_end (uiout, type, old_level);
 }
 
-void
-ui_out_list_end (struct ui_out *uiout)
-{
-  ui_out_end (uiout, ui_out_type_list);
-}
-
-void
-ui_out_tuple_end (struct ui_out *uiout)
-{
-  ui_out_end (uiout, ui_out_type_tuple);
-}
-
 struct ui_out_end_cleanup_data
 {
   struct ui_out *uiout;
@@ -458,7 +449,7 @@ struct cleanup *
 make_cleanup_ui_out_tuple_begin_end (struct ui_out *uiout,
 				     const char *id)
 {
-  ui_out_tuple_begin (uiout, id);
+  ui_out_begin (uiout, ui_out_type_tuple, id);
   return make_cleanup_ui_out_end (uiout, ui_out_type_tuple);
 }
 
@@ -466,7 +457,7 @@ struct cleanup *
 make_cleanup_ui_out_list_begin_end (struct ui_out *uiout,
 				    const char *id)
 {
-  ui_out_list_begin (uiout, id);
+  ui_out_begin (uiout, ui_out_type_list, id);
   return make_cleanup_ui_out_end (uiout, ui_out_type_list);
 }
 
Index: ui-out.h
===================================================================
RCS file: /cvs/uberbaum/gdb/ui-out.h,v
retrieving revision 1.16
diff -u -p -r1.16 ui-out.h
--- ui-out.h	3 Oct 2002 22:34:58 -0000	1.16
+++ ui-out.h	31 Jan 2003 23:59:50 -0000
@@ -88,30 +88,20 @@ extern struct cleanup *ui_out_begin_clea
    implied structure: ``table = { hdr = { header, ... } , body = [ {
    field, ... }, ... ] }''. If NR_ROWS is negative then there is at
    least one row. */
-
-extern void ui_out_table_begin (struct ui_out *uiout, int nbrofcols,
-				int nr_rows, const char *tblid);
-
 extern void ui_out_table_header (struct ui_out *uiout, int width,
 				 enum ui_align align, const char *col_name,
 				 const char *colhdr);
 
 extern void ui_out_table_body (struct ui_out *uiout);
 
-extern void ui_out_table_end (struct ui_out *uiout);
-
+extern struct cleanup *make_cleanup_ui_out_table_begin_end (struct ui_out *ui_out,
+                                                            int nr_cols,
+                                                           int nr_rows,
+                                                           const char *tblid);
 /* Compatibility wrappers.  */
 
-extern void ui_out_list_begin (struct ui_out *uiout, const char *id);
-
-extern void ui_out_list_end (struct ui_out *uiout);
-
 extern struct cleanup *make_cleanup_ui_out_list_begin_end (struct ui_out *uiout,
 							   const char *id);
-
-extern void ui_out_tuple_begin (struct ui_out *uiout, const char *id);
-
-extern void ui_out_tuple_end (struct ui_out *uiout);
 
 extern struct cleanup *make_cleanup_ui_out_tuple_begin_end (struct ui_out *uiout,
 							    const char *id);
Index: thread.c
===================================================================
RCS file: /cvs/uberbaum/gdb/thread.c,v
retrieving revision 1.27
diff -u -p -r1.27 thread.c
--- thread.c	14 Jan 2003 00:07:43 -0000	1.27
+++ thread.c	31 Jan 2003 23:59:58 -0000
@@ -261,11 +261,12 @@ do_captured_list_thread_ids (struct ui_o
 {
   struct thread_info *tp;
   int num = 0;
+  struct cleanup *cleanup_chain;
 
   prune_threads ();
   target_find_new_threads ();
 
-  ui_out_tuple_begin (uiout, "thread-ids");
+  cleanup_chain = make_cleanup_ui_out_tuple_begin_end (uiout, "thread-ids");
 
   for (tp = thread_list; tp; tp = tp->next)
     {
@@ -273,7 +274,7 @@ do_captured_list_thread_ids (struct ui_o
       ui_out_field_int (uiout, "thread-id", tp->num);
     }
 
-  ui_out_tuple_end (uiout);
+  do_cleanups (cleanup_chain);
   ui_out_field_int (uiout, "number-of-threads", num);
   return GDB_RC_OK;
 }

Index: cli/cli-setshow.c
===================================================================
RCS file: /cvs/uberbaum/gdb/cli/cli-setshow.c,v
retrieving revision 1.11
diff -u -p -r1.11 cli-setshow.c
--- cli/cli-setshow.c	10 Dec 2002 00:30:43 -0000	1.11
+++ cli/cli-setshow.c	1 Feb 2003 00:00:11 -0000
@@ -1,6 +1,6 @@
 /* Handle set and show GDB commands.
 
-   Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
+   Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -353,28 +353,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);
+	  /* Close the tuple.  */
+	  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);
+          /* Close the tuple.  */
+	  do_cleanups (option_chain);
 	}
     }
-  ui_out_tuple_end (uiout);
+  /* Close the tuple.  */
+  do_cleanups (showlist_chain);
 }
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]