Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* patch for gdb/mi 680
@ 2002-10-10 14:03 J. Johnston
  2002-10-21 16:06 ` Elena Zannoni
  2002-10-21 16:08 ` Elena Zannoni
  0 siblings, 2 replies; 7+ messages in thread
From: J. Johnston @ 2002-10-10 14:03 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 915 bytes --]

The following is a patch for PR gdb/mi 680.  To summarize, the patch changes
all usages of ui_out_tuple_begin/ui_out_tuple_end and ui_out_list_begin/ui_out_list_end
in the mi code to use the make_cleanup_ui_out_xxxx_begin_end/do_cleanups alternative.  This patch
was generated from code that contains other patches I have made that have not yet been 
approved so I have diff'd so only the changes pertaining to this PR are shown.  

gdb/mi/ChangeLog:

2002-10-10  Jeff Johnston  <jjohnstn@redhat.com>

        * mi-cmd-var.c: Change all remaining occurrences of ui_out_tuple_begin to
        make_cleanup_ui_out_tuple_begin_end.  Change all remaining occurrences of
        ui_out_list_begin to make_cleanup_ui_out_list_begin_end.  Use do_cleanups
        instead of ui_out_list_end or ui_out_tuple_end.  This is a fix for
        PR gdb/680.
        * mi-cmd-stack.c: Ditto.
        * mi-main.c: Ditto.

-- Jeff J.

[-- Attachment #2: 680.patch --]
[-- Type: text/plain, Size: 7726 bytes --]

Index: mi/mi-cmd-stack.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-cmd-stack.c,v
retrieving revision 1.11
diff -u -r1.11 mi-cmd-stack.c
--- mi/mi-cmd-stack.c	5 Apr 2002 22:04:43 -0000	1.11
+++ mi/mi-cmd-stack.c	10 Oct 2002 19:34:51 -0000
@@ -45,6 +45,7 @@
   int frame_low;
   int frame_high;
   int i;
+  struct cleanup *cleanup;
   struct frame_info *fi;
 
   if (!target_has_stack)
@@ -76,7 +77,7 @@
   if (fi == NULL)
     error ("mi_cmd_stack_list_frames: Not enough frames in stack.");
 
-  ui_out_list_begin (uiout, "stack");
+  cleanup = make_cleanup_ui_out_list_begin_end (uiout, "stack");
 
   /* Now let;s print the frames up to frame_high, or until there are
      frames in the stack. */
@@ -95,7 +96,7 @@
 			0 /* args */ );
     }
 
-  ui_out_list_end (uiout);
+  do_cleanups (cleanup);
   if (i < frame_high)
     error ("mi_cmd_stack_list_frames: Not enough frames in stack.");
 
@@ -155,6 +156,7 @@
   int frame_high;
   int i;
   struct frame_info *fi;
+  struct cleanup *cleanup;
 
   if (argc < 1 || argc > 3 || argc == 2)
     error ("mi_cmd_stack_list_args: Usage: PRINT_VALUES [FRAME_LOW FRAME_HIGH]");
@@ -182,7 +184,7 @@
   if (fi == NULL)
     error ("mi_cmd_stack_list_args: Not enough frames in stack.");
 
-  ui_out_list_begin (uiout, "stack-args");
+  cleanup = make_cleanup_ui_out_list_begin_end (uiout, "stack-args");
 
   /* Now let's print the frames up to frame_high, or until there are
      frames in the stack. */
@@ -190,14 +192,15 @@
        fi && (i <= frame_high || frame_high == -1);
        i++, fi = get_prev_frame (fi))
     {
+      struct cleanup *cleanup2;
       QUIT;
-      ui_out_tuple_begin (uiout, "frame");
+      cleanup2 = make_cleanup_ui_out_tuple_begin_end (uiout, "frame");
       ui_out_field_int (uiout, "level", i);
       list_args_or_locals (0, atoi (argv[0]), fi);
-      ui_out_tuple_end (uiout);
+      do_cleanups (cleanup2);
     }
 
-  ui_out_list_end (uiout);
+  do_cleanups (cleanup);
   if (i < frame_high)
     error ("mi_cmd_stack_list_args: Not enough frames in stack.");
 
@@ -214,13 +217,14 @@
   struct block *block;
   struct symbol *sym;
   int i, nsyms;
+  struct cleanup *cleanup;
   static struct ui_stream *stb = NULL;
 
   stb = ui_out_stream_new (uiout);
 
   block = get_frame_block (fi, 0);
 
-  ui_out_list_begin (uiout, locals ? "locals" : "args");
+  cleanup = make_cleanup_ui_out_list_begin_end (uiout, locals ? "locals" : "args");
 
   while (block != 0)
     {
@@ -262,8 +266,9 @@
 	    }
 	  if (print_me)
 	    {
+	      struct cleanup *cleanup2;
 	      if (values)
-		ui_out_tuple_begin (uiout, NULL);
+		cleanup2 = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
 	      ui_out_field_string (uiout, "name", SYMBOL_NAME (sym));
 
 	      if (values)
@@ -278,7 +283,7 @@
 		    sym2 = sym;
 		  print_variable_value (sym2, fi, stb->stream);
 		  ui_out_field_stream (uiout, "value", stb);
-		  ui_out_tuple_end (uiout);
+		  do_cleanups (cleanup2);
 		}
 	    }
 	}
@@ -287,7 +292,7 @@
       else
 	block = BLOCK_SUPERBLOCK (block);
     }
-  ui_out_list_end (uiout);
+  do_cleanups (cleanup);
   ui_out_stream_delete (stb);
 }
 
--- mi/mi-cmd-var.0.c	Thu Oct 10 13:42:27 2002
+++ mi/mi-cmd-var.c	Thu Oct 10 14:05:33 2002
@@ -254,6 +254,7 @@
   struct varobj *var;
   struct varobj **childlist;
   struct varobj **cc;
+  struct cleanup *cleanup;
   int numchild;
   char *type;
 
@@ -271,11 +272,12 @@
   if (numchild <= 0)
     return MI_CMD_DONE;
 
-  ui_out_tuple_begin (uiout, "children");
+  cleanup = make_cleanup_ui_out_tuple_begin_end (uiout, "children");
   cc = childlist;
   while (*cc != NULL)
     {
-      ui_out_tuple_begin (uiout, "child");
+      struct cleanup *cleanup2;
+      cleanup2 = make_cleanup_ui_out_tuple_begin_end (uiout, "child");
       ui_out_field_string (uiout, "name", varobj_get_objname (*cc));
       ui_out_field_string (uiout, "exp", varobj_get_expression (*cc));
       ui_out_field_int (uiout, "numchild", varobj_get_num_children (*cc));
@@ -283,10 +285,10 @@
       /* C++ pseudo-variables (public, private, protected) do not have a type */
       if (type)
 	ui_out_field_string (uiout, "type", varobj_get_type (*cc));
-      ui_out_tuple_end (uiout);
+      do_cleanups (cleanup2);
       cc++;
     }
-  ui_out_tuple_end (uiout);
+  do_cleanups (cleanup);
   xfree (childlist);
   return MI_CMD_DONE;
 }
--- mi/mi-main.0.c	Thu Oct 10 13:52:55 2002
+++ mi/mi-main.c	Thu Oct 10 13:59:56 2002
@@ -911,19 +911,22 @@
   /* Build the result as a two dimentional table. */
   {
     struct ui_stream *stream = ui_out_stream_new (uiout);
+    struct cleanup *cleanup1;
     int row;
     int row_byte;
-    ui_out_list_begin (uiout, "memory");
+    cleanup1 = make_cleanup_ui_out_list_begin_end (uiout, "memory");
     for (row = 0, row_byte = 0;
 	 row < nr_rows;
 	 row++, row_byte += nr_cols * word_size)
       {
 	int col;
 	int col_byte;
-	ui_out_tuple_begin (uiout, NULL);
+	struct cleanup *cleanup2;
+	struct cleanup *cleanup3;
+	cleanup2 = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
 	ui_out_field_core_addr (uiout, "addr", addr + row_byte);
 	/* ui_out_field_core_addr_symbolic (uiout, "saddr", addr + row_byte); */
-	ui_out_list_begin (uiout, "data");
+	cleanup3 = make_cleanup_ui_out_list_begin_end (uiout, "data");
 	for (col = 0, col_byte = row_byte;
 	     col < nr_cols;
 	     col++, col_byte += word_size)
@@ -940,7 +943,7 @@
 		ui_out_field_stream (uiout, NULL, stream);
 	      }
 	  }
-	ui_out_list_end (uiout);
+	do_cleanups (cleanup3);
 	if (aschar)
 	  {
 	    int byte;
@@ -960,10 +963,10 @@
 	      }
 	    ui_out_field_stream (uiout, "ascii", stream);
 	  }
-	ui_out_tuple_end (uiout);
+	do_cleanups (cleanup2);
       }
     ui_out_stream_delete (stream);
-    ui_out_list_end (uiout);
+    do_cleanups (cleanup1);
   }
   do_cleanups (cleanups);
   return MI_CMD_DONE;
@@ -1415,17 +1418,18 @@
 		 strcmp (previous_sect_name, section_name) : 1);
   if (new_section)
     {
+      struct cleanup *cleanups;
       xfree (previous_sect_name);
       previous_sect_name = xstrdup (section_name);
 
       if (last_async_command)
 	fputs_unfiltered (last_async_command, raw_stdout);
       fputs_unfiltered ("+download", raw_stdout);
-      ui_out_tuple_begin (uiout, NULL);
+      cleanups = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
       ui_out_field_string (uiout, "section", section_name);
       ui_out_field_int (uiout, "section-size", total_section);
       ui_out_field_int (uiout, "total-size", grand_total);
-      ui_out_tuple_end (uiout);
+      do_cleanups (cleanups);
       mi_out_put (uiout, raw_stdout);
       fputs_unfiltered ("\n", raw_stdout);
       gdb_flush (raw_stdout);
@@ -1434,18 +1438,19 @@
   if (delta.tv_sec >= update_threshold.tv_sec &&
       delta.tv_usec >= update_threshold.tv_usec)
     {
+      struct cleanup *cleanups;
       last_update.tv_sec = time_now.tv_sec;
       last_update.tv_usec = time_now.tv_usec;
       if (last_async_command)
 	fputs_unfiltered (last_async_command, raw_stdout);
       fputs_unfiltered ("+download", raw_stdout);
-      ui_out_tuple_begin (uiout, NULL);
+      cleanups = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
       ui_out_field_string (uiout, "section", section_name);
       ui_out_field_int (uiout, "section-sent", sent_so_far);
       ui_out_field_int (uiout, "section-size", total_section);
       ui_out_field_int (uiout, "total-sent", total_sent);
       ui_out_field_int (uiout, "total-size", grand_total);
-      ui_out_tuple_end (uiout);
+      do_cleanups (cleanups);
       mi_out_put (uiout, raw_stdout);
       fputs_unfiltered ("\n", raw_stdout);
       gdb_flush (raw_stdout);

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: patch for gdb/mi 680
  2002-10-10 14:03 patch for gdb/mi 680 J. Johnston
@ 2002-10-21 16:06 ` Elena Zannoni
  2002-10-21 16:08 ` Elena Zannoni
  1 sibling, 0 replies; 7+ messages in thread
From: Elena Zannoni @ 2002-10-21 16:06 UTC (permalink / raw)
  To: J. Johnston; +Cc: gdb-patches

J. Johnston writes:
 > The following is a patch for PR gdb/mi 680.  To summarize, the patch changes
 > all usages of ui_out_tuple_begin/ui_out_tuple_end and ui_out_list_begin/ui_out_list_end
 > in the mi code to use the make_cleanup_ui_out_xxxx_begin_end/do_cleanups alternative.  This patch
 > was generated from code that contains other patches I have made that have not yet been 
 > approved so I have diff'd so only the changes pertaining to this PR are shown.  
 > 

Approved, but (nitpick) I would prefer more meaningful names instead of
'cleanup1, cleanup2, cleanup3' Something like cleanup_frame,
cleanup_child, etc.

Elena


 > gdb/mi/ChangeLog:
 > 
 > 2002-10-10  Jeff Johnston  <jjohnstn@redhat.com>
 > 
 >         * mi-cmd-var.c: Change all remaining occurrences of ui_out_tuple_begin to
 >         make_cleanup_ui_out_tuple_begin_end.  Change all remaining occurrences of
 >         ui_out_list_begin to make_cleanup_ui_out_list_begin_end.  Use do_cleanups
 >         instead of ui_out_list_end or ui_out_tuple_end.  This is a fix for
 >         PR gdb/680.
 >         * mi-cmd-stack.c: Ditto.
 >         * mi-main.c: Ditto.
 > 
 > -- Jeff J.Index: mi/mi-cmd-stack.c
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/mi/mi-cmd-stack.c,v
 > retrieving revision 1.11
 > diff -u -r1.11 mi-cmd-stack.c
 > --- mi/mi-cmd-stack.c	5 Apr 2002 22:04:43 -0000	1.11
 > +++ mi/mi-cmd-stack.c	10 Oct 2002 19:34:51 -0000
 > @@ -45,6 +45,7 @@
 >    int frame_low;
 >    int frame_high;
 >    int i;
 > +  struct cleanup *cleanup;
 >    struct frame_info *fi;
 >  
 >    if (!target_has_stack)
 > @@ -76,7 +77,7 @@
 >    if (fi == NULL)
 >      error ("mi_cmd_stack_list_frames: Not enough frames in stack.");
 >  
 > -  ui_out_list_begin (uiout, "stack");
 > +  cleanup = make_cleanup_ui_out_list_begin_end (uiout, "stack");
 >  
 >    /* Now let;s print the frames up to frame_high, or until there are
 >       frames in the stack. */
 > @@ -95,7 +96,7 @@
 >  			0 /* args */ );
 >      }
 >  
 > -  ui_out_list_end (uiout);
 > +  do_cleanups (cleanup);
 >    if (i < frame_high)
 >      error ("mi_cmd_stack_list_frames: Not enough frames in stack.");
 >  
 > @@ -155,6 +156,7 @@
 >    int frame_high;
 >    int i;
 >    struct frame_info *fi;
 > +  struct cleanup *cleanup;
 >  
 >    if (argc < 1 || argc > 3 || argc == 2)
 >      error ("mi_cmd_stack_list_args: Usage: PRINT_VALUES [FRAME_LOW FRAME_HIGH]");
 > @@ -182,7 +184,7 @@
 >    if (fi == NULL)
 >      error ("mi_cmd_stack_list_args: Not enough frames in stack.");
 >  
 > -  ui_out_list_begin (uiout, "stack-args");
 > +  cleanup = make_cleanup_ui_out_list_begin_end (uiout, "stack-args");
 >  
 >    /* Now let's print the frames up to frame_high, or until there are
 >       frames in the stack. */
 > @@ -190,14 +192,15 @@
 >         fi && (i <= frame_high || frame_high == -1);
 >         i++, fi = get_prev_frame (fi))
 >      {
 > +      struct cleanup *cleanup2;
 >        QUIT;
 > -      ui_out_tuple_begin (uiout, "frame");
 > +      cleanup2 = make_cleanup_ui_out_tuple_begin_end (uiout, "frame");
 >        ui_out_field_int (uiout, "level", i);
 >        list_args_or_locals (0, atoi (argv[0]), fi);
 > -      ui_out_tuple_end (uiout);
 > +      do_cleanups (cleanup2);
 >      }
 >  
 > -  ui_out_list_end (uiout);
 > +  do_cleanups (cleanup);
 >    if (i < frame_high)
 >      error ("mi_cmd_stack_list_args: Not enough frames in stack.");
 >  
 > @@ -214,13 +217,14 @@
 >    struct block *block;
 >    struct symbol *sym;
 >    int i, nsyms;
 > +  struct cleanup *cleanup;
 >    static struct ui_stream *stb = NULL;
 >  
 >    stb = ui_out_stream_new (uiout);
 >  
 >    block = get_frame_block (fi, 0);
 >  
 > -  ui_out_list_begin (uiout, locals ? "locals" : "args");
 > +  cleanup = make_cleanup_ui_out_list_begin_end (uiout, locals ? "locals" : "args");
 >  
 >    while (block != 0)
 >      {
 > @@ -262,8 +266,9 @@
 >  	    }
 >  	  if (print_me)
 >  	    {
 > +	      struct cleanup *cleanup2;
 >  	      if (values)
 > -		ui_out_tuple_begin (uiout, NULL);
 > +		cleanup2 = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
 >  	      ui_out_field_string (uiout, "name", SYMBOL_NAME (sym));
 >  
 >  	      if (values)
 > @@ -278,7 +283,7 @@
 >  		    sym2 = sym;
 >  		  print_variable_value (sym2, fi, stb->stream);
 >  		  ui_out_field_stream (uiout, "value", stb);
 > -		  ui_out_tuple_end (uiout);
 > +		  do_cleanups (cleanup2);
 >  		}
 >  	    }
 >  	}
 > @@ -287,7 +292,7 @@
 >        else
 >  	block = BLOCK_SUPERBLOCK (block);
 >      }
 > -  ui_out_list_end (uiout);
 > +  do_cleanups (cleanup);
 >    ui_out_stream_delete (stb);
 >  }
 >  
 > --- mi/mi-cmd-var.0.c	Thu Oct 10 13:42:27 2002
 > +++ mi/mi-cmd-var.c	Thu Oct 10 14:05:33 2002
 > @@ -254,6 +254,7 @@
 >    struct varobj *var;
 >    struct varobj **childlist;
 >    struct varobj **cc;
 > +  struct cleanup *cleanup;
 >    int numchild;
 >    char *type;
 >  
 > @@ -271,11 +272,12 @@
 >    if (numchild <= 0)
 >      return MI_CMD_DONE;
 >  
 > -  ui_out_tuple_begin (uiout, "children");
 > +  cleanup = make_cleanup_ui_out_tuple_begin_end (uiout, "children");
 >    cc = childlist;
 >    while (*cc != NULL)
 >      {
 > -      ui_out_tuple_begin (uiout, "child");
 > +      struct cleanup *cleanup2;
 > +      cleanup2 = make_cleanup_ui_out_tuple_begin_end (uiout, "child");
 >        ui_out_field_string (uiout, "name", varobj_get_objname (*cc));
 >        ui_out_field_string (uiout, "exp", varobj_get_expression (*cc));
 >        ui_out_field_int (uiout, "numchild", varobj_get_num_children (*cc));
 > @@ -283,10 +285,10 @@
 >        /* C++ pseudo-variables (public, private, protected) do not have a type */
 >        if (type)
 >  	ui_out_field_string (uiout, "type", varobj_get_type (*cc));
 > -      ui_out_tuple_end (uiout);
 > +      do_cleanups (cleanup2);
 >        cc++;
 >      }
 > -  ui_out_tuple_end (uiout);
 > +  do_cleanups (cleanup);
 >    xfree (childlist);
 >    return MI_CMD_DONE;
 >  }
 > --- mi/mi-main.0.c	Thu Oct 10 13:52:55 2002
 > +++ mi/mi-main.c	Thu Oct 10 13:59:56 2002
 > @@ -911,19 +911,22 @@
 >    /* Build the result as a two dimentional table. */
 >    {
 >      struct ui_stream *stream = ui_out_stream_new (uiout);
 > +    struct cleanup *cleanup1;
 >      int row;
 >      int row_byte;
 > -    ui_out_list_begin (uiout, "memory");
 > +    cleanup1 = make_cleanup_ui_out_list_begin_end (uiout, "memory");
 >      for (row = 0, row_byte = 0;
 >  	 row < nr_rows;
 >  	 row++, row_byte += nr_cols * word_size)
 >        {
 >  	int col;
 >  	int col_byte;
 > -	ui_out_tuple_begin (uiout, NULL);
 > +	struct cleanup *cleanup2;
 > +	struct cleanup *cleanup3;
 > +	cleanup2 = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
 >  	ui_out_field_core_addr (uiout, "addr", addr + row_byte);
 >  	/* ui_out_field_core_addr_symbolic (uiout, "saddr", addr + row_byte); */
 > -	ui_out_list_begin (uiout, "data");
 > +	cleanup3 = make_cleanup_ui_out_list_begin_end (uiout, "data");
 >  	for (col = 0, col_byte = row_byte;
 >  	     col < nr_cols;
 >  	     col++, col_byte += word_size)
 > @@ -940,7 +943,7 @@
 >  		ui_out_field_stream (uiout, NULL, stream);
 >  	      }
 >  	  }
 > -	ui_out_list_end (uiout);
 > +	do_cleanups (cleanup3);
 >  	if (aschar)
 >  	  {
 >  	    int byte;
 > @@ -960,10 +963,10 @@
 >  	      }
 >  	    ui_out_field_stream (uiout, "ascii", stream);
 >  	  }
 > -	ui_out_tuple_end (uiout);
 > +	do_cleanups (cleanup2);
 >        }
 >      ui_out_stream_delete (stream);
 > -    ui_out_list_end (uiout);
 > +    do_cleanups (cleanup1);
 >    }
 >    do_cleanups (cleanups);
 >    return MI_CMD_DONE;
 > @@ -1415,17 +1418,18 @@
 >  		 strcmp (previous_sect_name, section_name) : 1);
 >    if (new_section)
 >      {
 > +      struct cleanup *cleanups;
 >        xfree (previous_sect_name);
 >        previous_sect_name = xstrdup (section_name);
 >  
 >        if (last_async_command)
 >  	fputs_unfiltered (last_async_command, raw_stdout);
 >        fputs_unfiltered ("+download", raw_stdout);
 > -      ui_out_tuple_begin (uiout, NULL);
 > +      cleanups = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
 >        ui_out_field_string (uiout, "section", section_name);
 >        ui_out_field_int (uiout, "section-size", total_section);
 >        ui_out_field_int (uiout, "total-size", grand_total);
 > -      ui_out_tuple_end (uiout);
 > +      do_cleanups (cleanups);
 >        mi_out_put (uiout, raw_stdout);
 >        fputs_unfiltered ("\n", raw_stdout);
 >        gdb_flush (raw_stdout);
 > @@ -1434,18 +1438,19 @@
 >    if (delta.tv_sec >= update_threshold.tv_sec &&
 >        delta.tv_usec >= update_threshold.tv_usec)
 >      {
 > +      struct cleanup *cleanups;
 >        last_update.tv_sec = time_now.tv_sec;
 >        last_update.tv_usec = time_now.tv_usec;
 >        if (last_async_command)
 >  	fputs_unfiltered (last_async_command, raw_stdout);
 >        fputs_unfiltered ("+download", raw_stdout);
 > -      ui_out_tuple_begin (uiout, NULL);
 > +      cleanups = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
 >        ui_out_field_string (uiout, "section", section_name);
 >        ui_out_field_int (uiout, "section-sent", sent_so_far);
 >        ui_out_field_int (uiout, "section-size", total_section);
 >        ui_out_field_int (uiout, "total-sent", total_sent);
 >        ui_out_field_int (uiout, "total-size", grand_total);
 > -      ui_out_tuple_end (uiout);
 > +      do_cleanups (cleanups);
 >        mi_out_put (uiout, raw_stdout);
 >        fputs_unfiltered ("\n", raw_stdout);
 >        gdb_flush (raw_stdout);


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: patch for gdb/mi 680
  2002-10-10 14:03 patch for gdb/mi 680 J. Johnston
  2002-10-21 16:06 ` Elena Zannoni
@ 2002-10-21 16:08 ` Elena Zannoni
  2002-10-21 16:34   ` J. Johnston
  2002-10-21 18:13   ` Andrew Cagney
  1 sibling, 2 replies; 7+ messages in thread
From: Elena Zannoni @ 2002-10-21 16:08 UTC (permalink / raw)
  To: J. Johnston; +Cc: gdb-patches


Another thing, are there any more uses of ui_out_tuple_begin
ui_out_tuple_end, etc?  Could the functions be zapped/ifdeffed out, so that
they are not creep in again?

Elena


J. Johnston writes:
 > The following is a patch for PR gdb/mi 680.  To summarize, the patch changes
 > all usages of ui_out_tuple_begin/ui_out_tuple_end and ui_out_list_begin/ui_out_list_end
 > in the mi code to use the make_cleanup_ui_out_xxxx_begin_end/do_cleanups alternative.  This patch
 > was generated from code that contains other patches I have made that have not yet been 
 > approved so I have diff'd so only the changes pertaining to this PR are shown.  
 > 
 > gdb/mi/ChangeLog:
 > 
 > 2002-10-10  Jeff Johnston  <jjohnstn@redhat.com>
 > 
 >         * mi-cmd-var.c: Change all remaining occurrences of ui_out_tuple_begin to
 >         make_cleanup_ui_out_tuple_begin_end.  Change all remaining occurrences of
 >         ui_out_list_begin to make_cleanup_ui_out_list_begin_end.  Use do_cleanups
 >         instead of ui_out_list_end or ui_out_tuple_end.  This is a fix for
 >         PR gdb/680.
 >         * mi-cmd-stack.c: Ditto.
 >         * mi-main.c: Ditto.
 > 
 > -- Jeff J.Index: mi/mi-cmd-stack.c
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/mi/mi-cmd-stack.c,v
 > retrieving revision 1.11
 > diff -u -r1.11 mi-cmd-stack.c
 > --- mi/mi-cmd-stack.c	5 Apr 2002 22:04:43 -0000	1.11
 > +++ mi/mi-cmd-stack.c	10 Oct 2002 19:34:51 -0000
 > @@ -45,6 +45,7 @@
 >    int frame_low;
 >    int frame_high;
 >    int i;
 > +  struct cleanup *cleanup;
 >    struct frame_info *fi;
 >  
 >    if (!target_has_stack)
 > @@ -76,7 +77,7 @@
 >    if (fi == NULL)
 >      error ("mi_cmd_stack_list_frames: Not enough frames in stack.");
 >  
 > -  ui_out_list_begin (uiout, "stack");
 > +  cleanup = make_cleanup_ui_out_list_begin_end (uiout, "stack");
 >  
 >    /* Now let;s print the frames up to frame_high, or until there are
 >       frames in the stack. */
 > @@ -95,7 +96,7 @@
 >  			0 /* args */ );
 >      }
 >  
 > -  ui_out_list_end (uiout);
 > +  do_cleanups (cleanup);
 >    if (i < frame_high)
 >      error ("mi_cmd_stack_list_frames: Not enough frames in stack.");
 >  
 > @@ -155,6 +156,7 @@
 >    int frame_high;
 >    int i;
 >    struct frame_info *fi;
 > +  struct cleanup *cleanup;
 >  
 >    if (argc < 1 || argc > 3 || argc == 2)
 >      error ("mi_cmd_stack_list_args: Usage: PRINT_VALUES [FRAME_LOW FRAME_HIGH]");
 > @@ -182,7 +184,7 @@
 >    if (fi == NULL)
 >      error ("mi_cmd_stack_list_args: Not enough frames in stack.");
 >  
 > -  ui_out_list_begin (uiout, "stack-args");
 > +  cleanup = make_cleanup_ui_out_list_begin_end (uiout, "stack-args");
 >  
 >    /* Now let's print the frames up to frame_high, or until there are
 >       frames in the stack. */
 > @@ -190,14 +192,15 @@
 >         fi && (i <= frame_high || frame_high == -1);
 >         i++, fi = get_prev_frame (fi))
 >      {
 > +      struct cleanup *cleanup2;
 >        QUIT;
 > -      ui_out_tuple_begin (uiout, "frame");
 > +      cleanup2 = make_cleanup_ui_out_tuple_begin_end (uiout, "frame");
 >        ui_out_field_int (uiout, "level", i);
 >        list_args_or_locals (0, atoi (argv[0]), fi);
 > -      ui_out_tuple_end (uiout);
 > +      do_cleanups (cleanup2);
 >      }
 >  
 > -  ui_out_list_end (uiout);
 > +  do_cleanups (cleanup);
 >    if (i < frame_high)
 >      error ("mi_cmd_stack_list_args: Not enough frames in stack.");
 >  
 > @@ -214,13 +217,14 @@
 >    struct block *block;
 >    struct symbol *sym;
 >    int i, nsyms;
 > +  struct cleanup *cleanup;
 >    static struct ui_stream *stb = NULL;
 >  
 >    stb = ui_out_stream_new (uiout);
 >  
 >    block = get_frame_block (fi, 0);
 >  
 > -  ui_out_list_begin (uiout, locals ? "locals" : "args");
 > +  cleanup = make_cleanup_ui_out_list_begin_end (uiout, locals ? "locals" : "args");
 >  
 >    while (block != 0)
 >      {
 > @@ -262,8 +266,9 @@
 >  	    }
 >  	  if (print_me)
 >  	    {
 > +	      struct cleanup *cleanup2;
 >  	      if (values)
 > -		ui_out_tuple_begin (uiout, NULL);
 > +		cleanup2 = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
 >  	      ui_out_field_string (uiout, "name", SYMBOL_NAME (sym));
 >  
 >  	      if (values)
 > @@ -278,7 +283,7 @@
 >  		    sym2 = sym;
 >  		  print_variable_value (sym2, fi, stb->stream);
 >  		  ui_out_field_stream (uiout, "value", stb);
 > -		  ui_out_tuple_end (uiout);
 > +		  do_cleanups (cleanup2);
 >  		}
 >  	    }
 >  	}
 > @@ -287,7 +292,7 @@
 >        else
 >  	block = BLOCK_SUPERBLOCK (block);
 >      }
 > -  ui_out_list_end (uiout);
 > +  do_cleanups (cleanup);
 >    ui_out_stream_delete (stb);
 >  }
 >  
 > --- mi/mi-cmd-var.0.c	Thu Oct 10 13:42:27 2002
 > +++ mi/mi-cmd-var.c	Thu Oct 10 14:05:33 2002
 > @@ -254,6 +254,7 @@
 >    struct varobj *var;
 >    struct varobj **childlist;
 >    struct varobj **cc;
 > +  struct cleanup *cleanup;
 >    int numchild;
 >    char *type;
 >  
 > @@ -271,11 +272,12 @@
 >    if (numchild <= 0)
 >      return MI_CMD_DONE;
 >  
 > -  ui_out_tuple_begin (uiout, "children");
 > +  cleanup = make_cleanup_ui_out_tuple_begin_end (uiout, "children");
 >    cc = childlist;
 >    while (*cc != NULL)
 >      {
 > -      ui_out_tuple_begin (uiout, "child");
 > +      struct cleanup *cleanup2;
 > +      cleanup2 = make_cleanup_ui_out_tuple_begin_end (uiout, "child");
 >        ui_out_field_string (uiout, "name", varobj_get_objname (*cc));
 >        ui_out_field_string (uiout, "exp", varobj_get_expression (*cc));
 >        ui_out_field_int (uiout, "numchild", varobj_get_num_children (*cc));
 > @@ -283,10 +285,10 @@
 >        /* C++ pseudo-variables (public, private, protected) do not have a type */
 >        if (type)
 >  	ui_out_field_string (uiout, "type", varobj_get_type (*cc));
 > -      ui_out_tuple_end (uiout);
 > +      do_cleanups (cleanup2);
 >        cc++;
 >      }
 > -  ui_out_tuple_end (uiout);
 > +  do_cleanups (cleanup);
 >    xfree (childlist);
 >    return MI_CMD_DONE;
 >  }
 > --- mi/mi-main.0.c	Thu Oct 10 13:52:55 2002
 > +++ mi/mi-main.c	Thu Oct 10 13:59:56 2002
 > @@ -911,19 +911,22 @@
 >    /* Build the result as a two dimentional table. */
 >    {
 >      struct ui_stream *stream = ui_out_stream_new (uiout);
 > +    struct cleanup *cleanup1;
 >      int row;
 >      int row_byte;
 > -    ui_out_list_begin (uiout, "memory");
 > +    cleanup1 = make_cleanup_ui_out_list_begin_end (uiout, "memory");
 >      for (row = 0, row_byte = 0;
 >  	 row < nr_rows;
 >  	 row++, row_byte += nr_cols * word_size)
 >        {
 >  	int col;
 >  	int col_byte;
 > -	ui_out_tuple_begin (uiout, NULL);
 > +	struct cleanup *cleanup2;
 > +	struct cleanup *cleanup3;
 > +	cleanup2 = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
 >  	ui_out_field_core_addr (uiout, "addr", addr + row_byte);
 >  	/* ui_out_field_core_addr_symbolic (uiout, "saddr", addr + row_byte); */
 > -	ui_out_list_begin (uiout, "data");
 > +	cleanup3 = make_cleanup_ui_out_list_begin_end (uiout, "data");
 >  	for (col = 0, col_byte = row_byte;
 >  	     col < nr_cols;
 >  	     col++, col_byte += word_size)
 > @@ -940,7 +943,7 @@
 >  		ui_out_field_stream (uiout, NULL, stream);
 >  	      }
 >  	  }
 > -	ui_out_list_end (uiout);
 > +	do_cleanups (cleanup3);
 >  	if (aschar)
 >  	  {
 >  	    int byte;
 > @@ -960,10 +963,10 @@
 >  	      }
 >  	    ui_out_field_stream (uiout, "ascii", stream);
 >  	  }
 > -	ui_out_tuple_end (uiout);
 > +	do_cleanups (cleanup2);
 >        }
 >      ui_out_stream_delete (stream);
 > -    ui_out_list_end (uiout);
 > +    do_cleanups (cleanup1);
 >    }
 >    do_cleanups (cleanups);
 >    return MI_CMD_DONE;
 > @@ -1415,17 +1418,18 @@
 >  		 strcmp (previous_sect_name, section_name) : 1);
 >    if (new_section)
 >      {
 > +      struct cleanup *cleanups;
 >        xfree (previous_sect_name);
 >        previous_sect_name = xstrdup (section_name);
 >  
 >        if (last_async_command)
 >  	fputs_unfiltered (last_async_command, raw_stdout);
 >        fputs_unfiltered ("+download", raw_stdout);
 > -      ui_out_tuple_begin (uiout, NULL);
 > +      cleanups = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
 >        ui_out_field_string (uiout, "section", section_name);
 >        ui_out_field_int (uiout, "section-size", total_section);
 >        ui_out_field_int (uiout, "total-size", grand_total);
 > -      ui_out_tuple_end (uiout);
 > +      do_cleanups (cleanups);
 >        mi_out_put (uiout, raw_stdout);
 >        fputs_unfiltered ("\n", raw_stdout);
 >        gdb_flush (raw_stdout);
 > @@ -1434,18 +1438,19 @@
 >    if (delta.tv_sec >= update_threshold.tv_sec &&
 >        delta.tv_usec >= update_threshold.tv_usec)
 >      {
 > +      struct cleanup *cleanups;
 >        last_update.tv_sec = time_now.tv_sec;
 >        last_update.tv_usec = time_now.tv_usec;
 >        if (last_async_command)
 >  	fputs_unfiltered (last_async_command, raw_stdout);
 >        fputs_unfiltered ("+download", raw_stdout);
 > -      ui_out_tuple_begin (uiout, NULL);
 > +      cleanups = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
 >        ui_out_field_string (uiout, "section", section_name);
 >        ui_out_field_int (uiout, "section-sent", sent_so_far);
 >        ui_out_field_int (uiout, "section-size", total_section);
 >        ui_out_field_int (uiout, "total-sent", total_sent);
 >        ui_out_field_int (uiout, "total-size", grand_total);
 > -      ui_out_tuple_end (uiout);
 > +      do_cleanups (cleanups);
 >        mi_out_put (uiout, raw_stdout);
 >        fputs_unfiltered ("\n", raw_stdout);
 >        gdb_flush (raw_stdout);


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: patch for gdb/mi 680
  2002-10-21 16:08 ` Elena Zannoni
@ 2002-10-21 16:34   ` J. Johnston
  2002-10-22  7:20     ` Elena Zannoni
  2002-10-21 18:13   ` Andrew Cagney
  1 sibling, 1 reply; 7+ messages in thread
From: J. Johnston @ 2002-10-21 16:34 UTC (permalink / raw)
  To: Elena Zannoni; +Cc: gdb-patches

Elena Zannoni wrote:
> 
> Another thing, are there any more uses of ui_out_tuple_begin
> ui_out_tuple_end, etc?  Could the functions be zapped/ifdeffed out, so that
> they are not creep in again?
> 

I made some extra changes for gdb/mi 796.  After that patch, the only files
containing the old tuple and list calls are breakpoint.c and cli/cli-setshow.c.  
I can make an addendum patch for 796 which includes the remaining changes and removal of
the tuple and list functions.

-- Jeff J.

> Elena
> 
> J. Johnston writes:
>  > The following is a patch for PR gdb/mi 680.  To summarize, the patch changes
>  > all usages of ui_out_tuple_begin/ui_out_tuple_end and ui_out_list_begin/ui_out_list_end
>  > in the mi code to use the make_cleanup_ui_out_xxxx_begin_end/do_cleanups alternative.  This patch
>  > was generated from code that contains other patches I have made that have not yet been
>  > approved so I have diff'd so only the changes pertaining to this PR are shown.
>  >
>  > gdb/mi/ChangeLog:
>  >
>  > 2002-10-10  Jeff Johnston  <jjohnstn@redhat.com>
>  >
>  >         * mi-cmd-var.c: Change all remaining occurrences of ui_out_tuple_begin to
>  >         make_cleanup_ui_out_tuple_begin_end.  Change all remaining occurrences of
>  >         ui_out_list_begin to make_cleanup_ui_out_list_begin_end.  Use do_cleanups
>  >         instead of ui_out_list_end or ui_out_tuple_end.  This is a fix for
>  >         PR gdb/680.
>  >         * mi-cmd-stack.c: Ditto.
>  >         * mi-main.c: Ditto.
>  >
>  > -- Jeff J.Index: mi/mi-cmd-stack.c
>  > ===================================================================
>  > RCS file: /cvs/src/src/gdb/mi/mi-cmd-stack.c,v
>  > retrieving revision 1.11
>  > diff -u -r1.11 mi-cmd-stack.c
>  > --- mi/mi-cmd-stack.c        5 Apr 2002 22:04:43 -0000       1.11
>  > +++ mi/mi-cmd-stack.c        10 Oct 2002 19:34:51 -0000
>  > @@ -45,6 +45,7 @@
>  >    int frame_low;
>  >    int frame_high;
>  >    int i;
>  > +  struct cleanup *cleanup;
>  >    struct frame_info *fi;
>  >
>  >    if (!target_has_stack)
>  > @@ -76,7 +77,7 @@
>  >    if (fi == NULL)
>  >      error ("mi_cmd_stack_list_frames: Not enough frames in stack.");
>  >
>  > -  ui_out_list_begin (uiout, "stack");
>  > +  cleanup = make_cleanup_ui_out_list_begin_end (uiout, "stack");
>  >
>  >    /* Now let;s print the frames up to frame_high, or until there are
>  >       frames in the stack. */
>  > @@ -95,7 +96,7 @@
>  >                      0 /* args */ );
>  >      }
>  >
>  > -  ui_out_list_end (uiout);
>  > +  do_cleanups (cleanup);
>  >    if (i < frame_high)
>  >      error ("mi_cmd_stack_list_frames: Not enough frames in stack.");
>  >
>  > @@ -155,6 +156,7 @@
>  >    int frame_high;
>  >    int i;
>  >    struct frame_info *fi;
>  > +  struct cleanup *cleanup;
>  >
>  >    if (argc < 1 || argc > 3 || argc == 2)
>  >      error ("mi_cmd_stack_list_args: Usage: PRINT_VALUES [FRAME_LOW FRAME_HIGH]");
>  > @@ -182,7 +184,7 @@
>  >    if (fi == NULL)
>  >      error ("mi_cmd_stack_list_args: Not enough frames in stack.");
>  >
>  > -  ui_out_list_begin (uiout, "stack-args");
>  > +  cleanup = make_cleanup_ui_out_list_begin_end (uiout, "stack-args");
>  >
>  >    /* Now let's print the frames up to frame_high, or until there are
>  >       frames in the stack. */
>  > @@ -190,14 +192,15 @@
>  >         fi && (i <= frame_high || frame_high == -1);
>  >         i++, fi = get_prev_frame (fi))
>  >      {
>  > +      struct cleanup *cleanup2;
>  >        QUIT;
>  > -      ui_out_tuple_begin (uiout, "frame");
>  > +      cleanup2 = make_cleanup_ui_out_tuple_begin_end (uiout, "frame");
>  >        ui_out_field_int (uiout, "level", i);
>  >        list_args_or_locals (0, atoi (argv[0]), fi);
>  > -      ui_out_tuple_end (uiout);
>  > +      do_cleanups (cleanup2);
>  >      }
>  >
>  > -  ui_out_list_end (uiout);
>  > +  do_cleanups (cleanup);
>  >    if (i < frame_high)
>  >      error ("mi_cmd_stack_list_args: Not enough frames in stack.");
>  >
>  > @@ -214,13 +217,14 @@
>  >    struct block *block;
>  >    struct symbol *sym;
>  >    int i, nsyms;
>  > +  struct cleanup *cleanup;
>  >    static struct ui_stream *stb = NULL;
>  >
>  >    stb = ui_out_stream_new (uiout);
>  >
>  >    block = get_frame_block (fi, 0);
>  >
>  > -  ui_out_list_begin (uiout, locals ? "locals" : "args");
>  > +  cleanup = make_cleanup_ui_out_list_begin_end (uiout, locals ? "locals" : "args");
>  >
>  >    while (block != 0)
>  >      {
>  > @@ -262,8 +266,9 @@
>  >          }
>  >        if (print_me)
>  >          {
>  > +          struct cleanup *cleanup2;
>  >            if (values)
>  > -            ui_out_tuple_begin (uiout, NULL);
>  > +            cleanup2 = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
>  >            ui_out_field_string (uiout, "name", SYMBOL_NAME (sym));
>  >
>  >            if (values)
>  > @@ -278,7 +283,7 @@
>  >                  sym2 = sym;
>  >                print_variable_value (sym2, fi, stb->stream);
>  >                ui_out_field_stream (uiout, "value", stb);
>  > -              ui_out_tuple_end (uiout);
>  > +              do_cleanups (cleanup2);
>  >              }
>  >          }
>  >      }
>  > @@ -287,7 +292,7 @@
>  >        else
>  >      block = BLOCK_SUPERBLOCK (block);
>  >      }
>  > -  ui_out_list_end (uiout);
>  > +  do_cleanups (cleanup);
>  >    ui_out_stream_delete (stb);
>  >  }
>  >
>  > --- mi/mi-cmd-var.0.c        Thu Oct 10 13:42:27 2002
>  > +++ mi/mi-cmd-var.c  Thu Oct 10 14:05:33 2002
>  > @@ -254,6 +254,7 @@
>  >    struct varobj *var;
>  >    struct varobj **childlist;
>  >    struct varobj **cc;
>  > +  struct cleanup *cleanup;
>  >    int numchild;
>  >    char *type;
>  >
>  > @@ -271,11 +272,12 @@
>  >    if (numchild <= 0)
>  >      return MI_CMD_DONE;
>  >
>  > -  ui_out_tuple_begin (uiout, "children");
>  > +  cleanup = make_cleanup_ui_out_tuple_begin_end (uiout, "children");
>  >    cc = childlist;
>  >    while (*cc != NULL)
>  >      {
>  > -      ui_out_tuple_begin (uiout, "child");
>  > +      struct cleanup *cleanup2;
>  > +      cleanup2 = make_cleanup_ui_out_tuple_begin_end (uiout, "child");
>  >        ui_out_field_string (uiout, "name", varobj_get_objname (*cc));
>  >        ui_out_field_string (uiout, "exp", varobj_get_expression (*cc));
>  >        ui_out_field_int (uiout, "numchild", varobj_get_num_children (*cc));
>  > @@ -283,10 +285,10 @@
>  >        /* C++ pseudo-variables (public, private, protected) do not have a type */
>  >        if (type)
>  >      ui_out_field_string (uiout, "type", varobj_get_type (*cc));
>  > -      ui_out_tuple_end (uiout);
>  > +      do_cleanups (cleanup2);
>  >        cc++;
>  >      }
>  > -  ui_out_tuple_end (uiout);
>  > +  do_cleanups (cleanup);
>  >    xfree (childlist);
>  >    return MI_CMD_DONE;
>  >  }
>  > --- mi/mi-main.0.c   Thu Oct 10 13:52:55 2002
>  > +++ mi/mi-main.c     Thu Oct 10 13:59:56 2002
>  > @@ -911,19 +911,22 @@
>  >    /* Build the result as a two dimentional table. */
>  >    {
>  >      struct ui_stream *stream = ui_out_stream_new (uiout);
>  > +    struct cleanup *cleanup1;
>  >      int row;
>  >      int row_byte;
>  > -    ui_out_list_begin (uiout, "memory");
>  > +    cleanup1 = make_cleanup_ui_out_list_begin_end (uiout, "memory");
>  >      for (row = 0, row_byte = 0;
>  >       row < nr_rows;
>  >       row++, row_byte += nr_cols * word_size)
>  >        {
>  >      int col;
>  >      int col_byte;
>  > -    ui_out_tuple_begin (uiout, NULL);
>  > +    struct cleanup *cleanup2;
>  > +    struct cleanup *cleanup3;
>  > +    cleanup2 = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
>  >      ui_out_field_core_addr (uiout, "addr", addr + row_byte);
>  >      /* ui_out_field_core_addr_symbolic (uiout, "saddr", addr + row_byte); */
>  > -    ui_out_list_begin (uiout, "data");
>  > +    cleanup3 = make_cleanup_ui_out_list_begin_end (uiout, "data");
>  >      for (col = 0, col_byte = row_byte;
>  >           col < nr_cols;
>  >           col++, col_byte += word_size)
>  > @@ -940,7 +943,7 @@
>  >              ui_out_field_stream (uiout, NULL, stream);
>  >            }
>  >        }
>  > -    ui_out_list_end (uiout);
>  > +    do_cleanups (cleanup3);
>  >      if (aschar)
>  >        {
>  >          int byte;
>  > @@ -960,10 +963,10 @@
>  >            }
>  >          ui_out_field_stream (uiout, "ascii", stream);
>  >        }
>  > -    ui_out_tuple_end (uiout);
>  > +    do_cleanups (cleanup2);
>  >        }
>  >      ui_out_stream_delete (stream);
>  > -    ui_out_list_end (uiout);
>  > +    do_cleanups (cleanup1);
>  >    }
>  >    do_cleanups (cleanups);
>  >    return MI_CMD_DONE;
>  > @@ -1415,17 +1418,18 @@
>  >               strcmp (previous_sect_name, section_name) : 1);
>  >    if (new_section)
>  >      {
>  > +      struct cleanup *cleanups;
>  >        xfree (previous_sect_name);
>  >        previous_sect_name = xstrdup (section_name);
>  >
>  >        if (last_async_command)
>  >      fputs_unfiltered (last_async_command, raw_stdout);
>  >        fputs_unfiltered ("+download", raw_stdout);
>  > -      ui_out_tuple_begin (uiout, NULL);
>  > +      cleanups = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
>  >        ui_out_field_string (uiout, "section", section_name);
>  >        ui_out_field_int (uiout, "section-size", total_section);
>  >        ui_out_field_int (uiout, "total-size", grand_total);
>  > -      ui_out_tuple_end (uiout);
>  > +      do_cleanups (cleanups);
>  >        mi_out_put (uiout, raw_stdout);
>  >        fputs_unfiltered ("\n", raw_stdout);
>  >        gdb_flush (raw_stdout);
>  > @@ -1434,18 +1438,19 @@
>  >    if (delta.tv_sec >= update_threshold.tv_sec &&
>  >        delta.tv_usec >= update_threshold.tv_usec)
>  >      {
>  > +      struct cleanup *cleanups;
>  >        last_update.tv_sec = time_now.tv_sec;
>  >        last_update.tv_usec = time_now.tv_usec;
>  >        if (last_async_command)
>  >      fputs_unfiltered (last_async_command, raw_stdout);
>  >        fputs_unfiltered ("+download", raw_stdout);
>  > -      ui_out_tuple_begin (uiout, NULL);
>  > +      cleanups = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
>  >        ui_out_field_string (uiout, "section", section_name);
>  >        ui_out_field_int (uiout, "section-sent", sent_so_far);
>  >        ui_out_field_int (uiout, "section-size", total_section);
>  >        ui_out_field_int (uiout, "total-sent", total_sent);
>  >        ui_out_field_int (uiout, "total-size", grand_total);
>  > -      ui_out_tuple_end (uiout);
>  > +      do_cleanups (cleanups);
>  >        mi_out_put (uiout, raw_stdout);
>  >        fputs_unfiltered ("\n", raw_stdout);
>  >        gdb_flush (raw_stdout);


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: patch for gdb/mi 680
  2002-10-21 16:08 ` Elena Zannoni
  2002-10-21 16:34   ` J. Johnston
@ 2002-10-21 18:13   ` Andrew Cagney
  1 sibling, 0 replies; 7+ messages in thread
From: Andrew Cagney @ 2002-10-21 18:13 UTC (permalink / raw)
  To: Elena Zannoni; +Cc: J. Johnston, gdb-patches

> Another thing, are there any more uses of ui_out_tuple_begin
> ui_out_tuple_end, etc?  Could the functions be zapped/ifdeffed out, so that
> they are not creep in again?

Definitly a good idea (zap it).

Andrew



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: patch for gdb/mi 680
  2002-10-21 16:34   ` J. Johnston
@ 2002-10-22  7:20     ` Elena Zannoni
  2002-10-23 14:20       ` J. Johnston
  0 siblings, 1 reply; 7+ messages in thread
From: Elena Zannoni @ 2002-10-22  7:20 UTC (permalink / raw)
  To: J. Johnston; +Cc: Elena Zannoni, gdb-patches

J. Johnston writes:
 > Elena Zannoni wrote:
 > > 
 > > Another thing, are there any more uses of ui_out_tuple_begin
 > > ui_out_tuple_end, etc?  Could the functions be zapped/ifdeffed out, so that
 > > they are not creep in again?
 > > 
 > 
 > I made some extra changes for gdb/mi 796.  After that patch, the only files
 > containing the old tuple and list calls are breakpoint.c and cli/cli-setshow.c.  

Great! 

 > I can make an addendum patch for 796 which includes the remaining changes and removal of
 > the tuple and list functions.
 > 

I suggest a separate patch with a separate email subject, since it
affects different files.

In case it wasn't clear you can commit this, in the meantime.
Thanks
Elena


 > -- Jeff J.
 > 
 > > Elena
 > > 
 > > J. Johnston writes:
 > >  > The following is a patch for PR gdb/mi 680.  To summarize, the patch changes
 > >  > all usages of ui_out_tuple_begin/ui_out_tuple_end and ui_out_list_begin/ui_out_list_end
 > >  > in the mi code to use the make_cleanup_ui_out_xxxx_begin_end/do_cleanups alternative.  This patch
 > >  > was generated from code that contains other patches I have made that have not yet been
 > >  > approved so I have diff'd so only the changes pertaining to this PR are shown.
 > >  >
 > >  > gdb/mi/ChangeLog:
 > >  >
 > >  > 2002-10-10  Jeff Johnston  <jjohnstn@redhat.com>
 > >  >
 > >  >         * mi-cmd-var.c: Change all remaining occurrences of ui_out_tuple_begin to
 > >  >         make_cleanup_ui_out_tuple_begin_end.  Change all remaining occurrences of
 > >  >         ui_out_list_begin to make_cleanup_ui_out_list_begin_end.  Use do_cleanups
 > >  >         instead of ui_out_list_end or ui_out_tuple_end.  This is a fix for
 > >  >         PR gdb/680.
 > >  >         * mi-cmd-stack.c: Ditto.
 > >  >         * mi-main.c: Ditto.
 > >  >
 > >  > -- Jeff J.Index: mi/mi-cmd-stack.c
 > >  > ===================================================================
 > >  > RCS file: /cvs/src/src/gdb/mi/mi-cmd-stack.c,v
 > >  > retrieving revision 1.11
 > >  > diff -u -r1.11 mi-cmd-stack.c
 > >  > --- mi/mi-cmd-stack.c        5 Apr 2002 22:04:43 -0000       1.11
 > >  > +++ mi/mi-cmd-stack.c        10 Oct 2002 19:34:51 -0000
 > >  > @@ -45,6 +45,7 @@
 > >  >    int frame_low;
 > >  >    int frame_high;
 > >  >    int i;
 > >  > +  struct cleanup *cleanup;
 > >  >    struct frame_info *fi;
 > >  >
 > >  >    if (!target_has_stack)
 > >  > @@ -76,7 +77,7 @@
 > >  >    if (fi == NULL)
 > >  >      error ("mi_cmd_stack_list_frames: Not enough frames in stack.");
 > >  >
 > >  > -  ui_out_list_begin (uiout, "stack");
 > >  > +  cleanup = make_cleanup_ui_out_list_begin_end (uiout, "stack");
 > >  >
 > >  >    /* Now let;s print the frames up to frame_high, or until there are
 > >  >       frames in the stack. */
 > >  > @@ -95,7 +96,7 @@
 > >  >                      0 /* args */ );
 > >  >      }
 > >  >
 > >  > -  ui_out_list_end (uiout);
 > >  > +  do_cleanups (cleanup);
 > >  >    if (i < frame_high)
 > >  >      error ("mi_cmd_stack_list_frames: Not enough frames in stack.");
 > >  >
 > >  > @@ -155,6 +156,7 @@
 > >  >    int frame_high;
 > >  >    int i;
 > >  >    struct frame_info *fi;
 > >  > +  struct cleanup *cleanup;
 > >  >
 > >  >    if (argc < 1 || argc > 3 || argc == 2)
 > >  >      error ("mi_cmd_stack_list_args: Usage: PRINT_VALUES [FRAME_LOW FRAME_HIGH]");
 > >  > @@ -182,7 +184,7 @@
 > >  >    if (fi == NULL)
 > >  >      error ("mi_cmd_stack_list_args: Not enough frames in stack.");
 > >  >
 > >  > -  ui_out_list_begin (uiout, "stack-args");
 > >  > +  cleanup = make_cleanup_ui_out_list_begin_end (uiout, "stack-args");
 > >  >
 > >  >    /* Now let's print the frames up to frame_high, or until there are
 > >  >       frames in the stack. */
 > >  > @@ -190,14 +192,15 @@
 > >  >         fi && (i <= frame_high || frame_high == -1);
 > >  >         i++, fi = get_prev_frame (fi))
 > >  >      {
 > >  > +      struct cleanup *cleanup2;
 > >  >        QUIT;
 > >  > -      ui_out_tuple_begin (uiout, "frame");
 > >  > +      cleanup2 = make_cleanup_ui_out_tuple_begin_end (uiout, "frame");
 > >  >        ui_out_field_int (uiout, "level", i);
 > >  >        list_args_or_locals (0, atoi (argv[0]), fi);
 > >  > -      ui_out_tuple_end (uiout);
 > >  > +      do_cleanups (cleanup2);
 > >  >      }
 > >  >
 > >  > -  ui_out_list_end (uiout);
 > >  > +  do_cleanups (cleanup);
 > >  >    if (i < frame_high)
 > >  >      error ("mi_cmd_stack_list_args: Not enough frames in stack.");
 > >  >
 > >  > @@ -214,13 +217,14 @@
 > >  >    struct block *block;
 > >  >    struct symbol *sym;
 > >  >    int i, nsyms;
 > >  > +  struct cleanup *cleanup;
 > >  >    static struct ui_stream *stb = NULL;
 > >  >
 > >  >    stb = ui_out_stream_new (uiout);
 > >  >
 > >  >    block = get_frame_block (fi, 0);
 > >  >
 > >  > -  ui_out_list_begin (uiout, locals ? "locals" : "args");
 > >  > +  cleanup = make_cleanup_ui_out_list_begin_end (uiout, locals ? "locals" : "args");
 > >  >
 > >  >    while (block != 0)
 > >  >      {
 > >  > @@ -262,8 +266,9 @@
 > >  >          }
 > >  >        if (print_me)
 > >  >          {
 > >  > +          struct cleanup *cleanup2;
 > >  >            if (values)
 > >  > -            ui_out_tuple_begin (uiout, NULL);
 > >  > +            cleanup2 = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
 > >  >            ui_out_field_string (uiout, "name", SYMBOL_NAME (sym));
 > >  >
 > >  >            if (values)
 > >  > @@ -278,7 +283,7 @@
 > >  >                  sym2 = sym;
 > >  >                print_variable_value (sym2, fi, stb->stream);
 > >  >                ui_out_field_stream (uiout, "value", stb);
 > >  > -              ui_out_tuple_end (uiout);
 > >  > +              do_cleanups (cleanup2);
 > >  >              }
 > >  >          }
 > >  >      }
 > >  > @@ -287,7 +292,7 @@
 > >  >        else
 > >  >      block = BLOCK_SUPERBLOCK (block);
 > >  >      }
 > >  > -  ui_out_list_end (uiout);
 > >  > +  do_cleanups (cleanup);
 > >  >    ui_out_stream_delete (stb);
 > >  >  }
 > >  >
 > >  > --- mi/mi-cmd-var.0.c        Thu Oct 10 13:42:27 2002
 > >  > +++ mi/mi-cmd-var.c  Thu Oct 10 14:05:33 2002
 > >  > @@ -254,6 +254,7 @@
 > >  >    struct varobj *var;
 > >  >    struct varobj **childlist;
 > >  >    struct varobj **cc;
 > >  > +  struct cleanup *cleanup;
 > >  >    int numchild;
 > >  >    char *type;
 > >  >
 > >  > @@ -271,11 +272,12 @@
 > >  >    if (numchild <= 0)
 > >  >      return MI_CMD_DONE;
 > >  >
 > >  > -  ui_out_tuple_begin (uiout, "children");
 > >  > +  cleanup = make_cleanup_ui_out_tuple_begin_end (uiout, "children");
 > >  >    cc = childlist;
 > >  >    while (*cc != NULL)
 > >  >      {
 > >  > -      ui_out_tuple_begin (uiout, "child");
 > >  > +      struct cleanup *cleanup2;
 > >  > +      cleanup2 = make_cleanup_ui_out_tuple_begin_end (uiout, "child");
 > >  >        ui_out_field_string (uiout, "name", varobj_get_objname (*cc));
 > >  >        ui_out_field_string (uiout, "exp", varobj_get_expression (*cc));
 > >  >        ui_out_field_int (uiout, "numchild", varobj_get_num_children (*cc));
 > >  > @@ -283,10 +285,10 @@
 > >  >        /* C++ pseudo-variables (public, private, protected) do not have a type */
 > >  >        if (type)
 > >  >      ui_out_field_string (uiout, "type", varobj_get_type (*cc));
 > >  > -      ui_out_tuple_end (uiout);
 > >  > +      do_cleanups (cleanup2);
 > >  >        cc++;
 > >  >      }
 > >  > -  ui_out_tuple_end (uiout);
 > >  > +  do_cleanups (cleanup);
 > >  >    xfree (childlist);
 > >  >    return MI_CMD_DONE;
 > >  >  }
 > >  > --- mi/mi-main.0.c   Thu Oct 10 13:52:55 2002
 > >  > +++ mi/mi-main.c     Thu Oct 10 13:59:56 2002
 > >  > @@ -911,19 +911,22 @@
 > >  >    /* Build the result as a two dimentional table. */
 > >  >    {
 > >  >      struct ui_stream *stream = ui_out_stream_new (uiout);
 > >  > +    struct cleanup *cleanup1;
 > >  >      int row;
 > >  >      int row_byte;
 > >  > -    ui_out_list_begin (uiout, "memory");
 > >  > +    cleanup1 = make_cleanup_ui_out_list_begin_end (uiout, "memory");
 > >  >      for (row = 0, row_byte = 0;
 > >  >       row < nr_rows;
 > >  >       row++, row_byte += nr_cols * word_size)
 > >  >        {
 > >  >      int col;
 > >  >      int col_byte;
 > >  > -    ui_out_tuple_begin (uiout, NULL);
 > >  > +    struct cleanup *cleanup2;
 > >  > +    struct cleanup *cleanup3;
 > >  > +    cleanup2 = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
 > >  >      ui_out_field_core_addr (uiout, "addr", addr + row_byte);
 > >  >      /* ui_out_field_core_addr_symbolic (uiout, "saddr", addr + row_byte); */
 > >  > -    ui_out_list_begin (uiout, "data");
 > >  > +    cleanup3 = make_cleanup_ui_out_list_begin_end (uiout, "data");
 > >  >      for (col = 0, col_byte = row_byte;
 > >  >           col < nr_cols;
 > >  >           col++, col_byte += word_size)
 > >  > @@ -940,7 +943,7 @@
 > >  >              ui_out_field_stream (uiout, NULL, stream);
 > >  >            }
 > >  >        }
 > >  > -    ui_out_list_end (uiout);
 > >  > +    do_cleanups (cleanup3);
 > >  >      if (aschar)
 > >  >        {
 > >  >          int byte;
 > >  > @@ -960,10 +963,10 @@
 > >  >            }
 > >  >          ui_out_field_stream (uiout, "ascii", stream);
 > >  >        }
 > >  > -    ui_out_tuple_end (uiout);
 > >  > +    do_cleanups (cleanup2);
 > >  >        }
 > >  >      ui_out_stream_delete (stream);
 > >  > -    ui_out_list_end (uiout);
 > >  > +    do_cleanups (cleanup1);
 > >  >    }
 > >  >    do_cleanups (cleanups);
 > >  >    return MI_CMD_DONE;
 > >  > @@ -1415,17 +1418,18 @@
 > >  >               strcmp (previous_sect_name, section_name) : 1);
 > >  >    if (new_section)
 > >  >      {
 > >  > +      struct cleanup *cleanups;
 > >  >        xfree (previous_sect_name);
 > >  >        previous_sect_name = xstrdup (section_name);
 > >  >
 > >  >        if (last_async_command)
 > >  >      fputs_unfiltered (last_async_command, raw_stdout);
 > >  >        fputs_unfiltered ("+download", raw_stdout);
 > >  > -      ui_out_tuple_begin (uiout, NULL);
 > >  > +      cleanups = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
 > >  >        ui_out_field_string (uiout, "section", section_name);
 > >  >        ui_out_field_int (uiout, "section-size", total_section);
 > >  >        ui_out_field_int (uiout, "total-size", grand_total);
 > >  > -      ui_out_tuple_end (uiout);
 > >  > +      do_cleanups (cleanups);
 > >  >        mi_out_put (uiout, raw_stdout);
 > >  >        fputs_unfiltered ("\n", raw_stdout);
 > >  >        gdb_flush (raw_stdout);
 > >  > @@ -1434,18 +1438,19 @@
 > >  >    if (delta.tv_sec >= update_threshold.tv_sec &&
 > >  >        delta.tv_usec >= update_threshold.tv_usec)
 > >  >      {
 > >  > +      struct cleanup *cleanups;
 > >  >        last_update.tv_sec = time_now.tv_sec;
 > >  >        last_update.tv_usec = time_now.tv_usec;
 > >  >        if (last_async_command)
 > >  >      fputs_unfiltered (last_async_command, raw_stdout);
 > >  >        fputs_unfiltered ("+download", raw_stdout);
 > >  > -      ui_out_tuple_begin (uiout, NULL);
 > >  > +      cleanups = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
 > >  >        ui_out_field_string (uiout, "section", section_name);
 > >  >        ui_out_field_int (uiout, "section-sent", sent_so_far);
 > >  >        ui_out_field_int (uiout, "section-size", total_section);
 > >  >        ui_out_field_int (uiout, "total-sent", total_sent);
 > >  >        ui_out_field_int (uiout, "total-size", grand_total);
 > >  > -      ui_out_tuple_end (uiout);
 > >  > +      do_cleanups (cleanups);
 > >  >        mi_out_put (uiout, raw_stdout);
 > >  >        fputs_unfiltered ("\n", raw_stdout);
 > >  >        gdb_flush (raw_stdout);


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: patch for gdb/mi 680
  2002-10-22  7:20     ` Elena Zannoni
@ 2002-10-23 14:20       ` J. Johnston
  0 siblings, 0 replies; 7+ messages in thread
From: J. Johnston @ 2002-10-23 14:20 UTC (permalink / raw)
  To: Elena Zannoni; +Cc: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 12492 bytes --]

Elena Zannoni wrote:
> 
> J. Johnston writes:
>  > Elena Zannoni wrote:
>  > >
>  > > Another thing, are there any more uses of ui_out_tuple_begin
>  > > ui_out_tuple_end, etc?  Could the functions be zapped/ifdeffed out, so that
>  > > they are not creep in again?
>  > >
>  >
>  > I made some extra changes for gdb/mi 796.  After that patch, the only files
>  > containing the old tuple and list calls are breakpoint.c and cli/cli-setshow.c.
> 
> Great!
> 
>  > I can make an addendum patch for 796 which includes the remaining changes and removal of
>  > the tuple and list functions.
>  >
> 
> I suggest a separate patch with a separate email subject, since it
> affects different files.
> 
> In case it wasn't clear you can commit this, in the meantime.
> Thanks
> Elena
> 

Ok.  The attached patch has been committed into the repository.  I changed the
names in the original 680 patch to be more meaningful per your request.

-- Jeff J.

>  >
>  > > Elena
>  > >
>  > > J. Johnston writes:
>  > >  > The following is a patch for PR gdb/mi 680.  To summarize, the patch changes
>  > >  > all usages of ui_out_tuple_begin/ui_out_tuple_end and ui_out_list_begin/ui_out_list_end
>  > >  > in the mi code to use the make_cleanup_ui_out_xxxx_begin_end/do_cleanups alternative.  This patch
>  > >  > was generated from code that contains other patches I have made that have not yet been
>  > >  > approved so I have diff'd so only the changes pertaining to this PR are shown.
>  > >  >
>  > >  > gdb/mi/ChangeLog:
>  > >  >
>  > >  > 2002-10-10  Jeff Johnston  <jjohnstn@redhat.com>
>  > >  >
>  > >  >         * mi-cmd-var.c: Change all remaining occurrences of ui_out_tuple_begin to
>  > >  >         make_cleanup_ui_out_tuple_begin_end.  Change all remaining occurrences of
>  > >  >         ui_out_list_begin to make_cleanup_ui_out_list_begin_end.  Use do_cleanups
>  > >  >         instead of ui_out_list_end or ui_out_tuple_end.  This is a fix for
>  > >  >         PR gdb/680.
>  > >  >         * mi-cmd-stack.c: Ditto.
>  > >  >         * mi-main.c: Ditto.
>  > >  >
>  > >  > -- Jeff J.Index: mi/mi-cmd-stack.c
>  > >  > ===================================================================
>  > >  > RCS file: /cvs/src/src/gdb/mi/mi-cmd-stack.c,v
>  > >  > retrieving revision 1.11
>  > >  > diff -u -r1.11 mi-cmd-stack.c
>  > >  > --- mi/mi-cmd-stack.c        5 Apr 2002 22:04:43 -0000       1.11
>  > >  > +++ mi/mi-cmd-stack.c        10 Oct 2002 19:34:51 -0000
>  > >  > @@ -45,6 +45,7 @@
>  > >  >    int frame_low;
>  > >  >    int frame_high;
>  > >  >    int i;
>  > >  > +  struct cleanup *cleanup;
>  > >  >    struct frame_info *fi;
>  > >  >
>  > >  >    if (!target_has_stack)
>  > >  > @@ -76,7 +77,7 @@
>  > >  >    if (fi == NULL)
>  > >  >      error ("mi_cmd_stack_list_frames: Not enough frames in stack.");
>  > >  >
>  > >  > -  ui_out_list_begin (uiout, "stack");
>  > >  > +  cleanup = make_cleanup_ui_out_list_begin_end (uiout, "stack");
>  > >  >
>  > >  >    /* Now let;s print the frames up to frame_high, or until there are
>  > >  >       frames in the stack. */
>  > >  > @@ -95,7 +96,7 @@
>  > >  >                      0 /* args */ );
>  > >  >      }
>  > >  >
>  > >  > -  ui_out_list_end (uiout);
>  > >  > +  do_cleanups (cleanup);
>  > >  >    if (i < frame_high)
>  > >  >      error ("mi_cmd_stack_list_frames: Not enough frames in stack.");
>  > >  >
>  > >  > @@ -155,6 +156,7 @@
>  > >  >    int frame_high;
>  > >  >    int i;
>  > >  >    struct frame_info *fi;
>  > >  > +  struct cleanup *cleanup;
>  > >  >
>  > >  >    if (argc < 1 || argc > 3 || argc == 2)
>  > >  >      error ("mi_cmd_stack_list_args: Usage: PRINT_VALUES [FRAME_LOW FRAME_HIGH]");
>  > >  > @@ -182,7 +184,7 @@
>  > >  >    if (fi == NULL)
>  > >  >      error ("mi_cmd_stack_list_args: Not enough frames in stack.");
>  > >  >
>  > >  > -  ui_out_list_begin (uiout, "stack-args");
>  > >  > +  cleanup = make_cleanup_ui_out_list_begin_end (uiout, "stack-args");
>  > >  >
>  > >  >    /* Now let's print the frames up to frame_high, or until there are
>  > >  >       frames in the stack. */
>  > >  > @@ -190,14 +192,15 @@
>  > >  >         fi && (i <= frame_high || frame_high == -1);
>  > >  >         i++, fi = get_prev_frame (fi))
>  > >  >      {
>  > >  > +      struct cleanup *cleanup2;
>  > >  >        QUIT;
>  > >  > -      ui_out_tuple_begin (uiout, "frame");
>  > >  > +      cleanup2 = make_cleanup_ui_out_tuple_begin_end (uiout, "frame");
>  > >  >        ui_out_field_int (uiout, "level", i);
>  > >  >        list_args_or_locals (0, atoi (argv[0]), fi);
>  > >  > -      ui_out_tuple_end (uiout);
>  > >  > +      do_cleanups (cleanup2);
>  > >  >      }
>  > >  >
>  > >  > -  ui_out_list_end (uiout);
>  > >  > +  do_cleanups (cleanup);
>  > >  >    if (i < frame_high)
>  > >  >      error ("mi_cmd_stack_list_args: Not enough frames in stack.");
>  > >  >
>  > >  > @@ -214,13 +217,14 @@
>  > >  >    struct block *block;
>  > >  >    struct symbol *sym;
>  > >  >    int i, nsyms;
>  > >  > +  struct cleanup *cleanup;
>  > >  >    static struct ui_stream *stb = NULL;
>  > >  >
>  > >  >    stb = ui_out_stream_new (uiout);
>  > >  >
>  > >  >    block = get_frame_block (fi, 0);
>  > >  >
>  > >  > -  ui_out_list_begin (uiout, locals ? "locals" : "args");
>  > >  > +  cleanup = make_cleanup_ui_out_list_begin_end (uiout, locals ? "locals" : "args");
>  > >  >
>  > >  >    while (block != 0)
>  > >  >      {
>  > >  > @@ -262,8 +266,9 @@
>  > >  >          }
>  > >  >        if (print_me)
>  > >  >          {
>  > >  > +          struct cleanup *cleanup2;
>  > >  >            if (values)
>  > >  > -            ui_out_tuple_begin (uiout, NULL);
>  > >  > +            cleanup2 = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
>  > >  >            ui_out_field_string (uiout, "name", SYMBOL_NAME (sym));
>  > >  >
>  > >  >            if (values)
>  > >  > @@ -278,7 +283,7 @@
>  > >  >                  sym2 = sym;
>  > >  >                print_variable_value (sym2, fi, stb->stream);
>  > >  >                ui_out_field_stream (uiout, "value", stb);
>  > >  > -              ui_out_tuple_end (uiout);
>  > >  > +              do_cleanups (cleanup2);
>  > >  >              }
>  > >  >          }
>  > >  >      }
>  > >  > @@ -287,7 +292,7 @@
>  > >  >        else
>  > >  >      block = BLOCK_SUPERBLOCK (block);
>  > >  >      }
>  > >  > -  ui_out_list_end (uiout);
>  > >  > +  do_cleanups (cleanup);
>  > >  >    ui_out_stream_delete (stb);
>  > >  >  }
>  > >  >
>  > >  > --- mi/mi-cmd-var.0.c        Thu Oct 10 13:42:27 2002
>  > >  > +++ mi/mi-cmd-var.c  Thu Oct 10 14:05:33 2002
>  > >  > @@ -254,6 +254,7 @@
>  > >  >    struct varobj *var;
>  > >  >    struct varobj **childlist;
>  > >  >    struct varobj **cc;
>  > >  > +  struct cleanup *cleanup;
>  > >  >    int numchild;
>  > >  >    char *type;
>  > >  >
>  > >  > @@ -271,11 +272,12 @@
>  > >  >    if (numchild <= 0)
>  > >  >      return MI_CMD_DONE;
>  > >  >
>  > >  > -  ui_out_tuple_begin (uiout, "children");
>  > >  > +  cleanup = make_cleanup_ui_out_tuple_begin_end (uiout, "children");
>  > >  >    cc = childlist;
>  > >  >    while (*cc != NULL)
>  > >  >      {
>  > >  > -      ui_out_tuple_begin (uiout, "child");
>  > >  > +      struct cleanup *cleanup2;
>  > >  > +      cleanup2 = make_cleanup_ui_out_tuple_begin_end (uiout, "child");
>  > >  >        ui_out_field_string (uiout, "name", varobj_get_objname (*cc));
>  > >  >        ui_out_field_string (uiout, "exp", varobj_get_expression (*cc));
>  > >  >        ui_out_field_int (uiout, "numchild", varobj_get_num_children (*cc));
>  > >  > @@ -283,10 +285,10 @@
>  > >  >        /* C++ pseudo-variables (public, private, protected) do not have a type */
>  > >  >        if (type)
>  > >  >      ui_out_field_string (uiout, "type", varobj_get_type (*cc));
>  > >  > -      ui_out_tuple_end (uiout);
>  > >  > +      do_cleanups (cleanup2);
>  > >  >        cc++;
>  > >  >      }
>  > >  > -  ui_out_tuple_end (uiout);
>  > >  > +  do_cleanups (cleanup);
>  > >  >    xfree (childlist);
>  > >  >    return MI_CMD_DONE;
>  > >  >  }
>  > >  > --- mi/mi-main.0.c   Thu Oct 10 13:52:55 2002
>  > >  > +++ mi/mi-main.c     Thu Oct 10 13:59:56 2002
>  > >  > @@ -911,19 +911,22 @@
>  > >  >    /* Build the result as a two dimentional table. */
>  > >  >    {
>  > >  >      struct ui_stream *stream = ui_out_stream_new (uiout);
>  > >  > +    struct cleanup *cleanup1;
>  > >  >      int row;
>  > >  >      int row_byte;
>  > >  > -    ui_out_list_begin (uiout, "memory");
>  > >  > +    cleanup1 = make_cleanup_ui_out_list_begin_end (uiout, "memory");
>  > >  >      for (row = 0, row_byte = 0;
>  > >  >       row < nr_rows;
>  > >  >       row++, row_byte += nr_cols * word_size)
>  > >  >        {
>  > >  >      int col;
>  > >  >      int col_byte;
>  > >  > -    ui_out_tuple_begin (uiout, NULL);
>  > >  > +    struct cleanup *cleanup2;
>  > >  > +    struct cleanup *cleanup3;
>  > >  > +    cleanup2 = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
>  > >  >      ui_out_field_core_addr (uiout, "addr", addr + row_byte);
>  > >  >      /* ui_out_field_core_addr_symbolic (uiout, "saddr", addr + row_byte); */
>  > >  > -    ui_out_list_begin (uiout, "data");
>  > >  > +    cleanup3 = make_cleanup_ui_out_list_begin_end (uiout, "data");
>  > >  >      for (col = 0, col_byte = row_byte;
>  > >  >           col < nr_cols;
>  > >  >           col++, col_byte += word_size)
>  > >  > @@ -940,7 +943,7 @@
>  > >  >              ui_out_field_stream (uiout, NULL, stream);
>  > >  >            }
>  > >  >        }
>  > >  > -    ui_out_list_end (uiout);
>  > >  > +    do_cleanups (cleanup3);
>  > >  >      if (aschar)
>  > >  >        {
>  > >  >          int byte;
>  > >  > @@ -960,10 +963,10 @@
>  > >  >            }
>  > >  >          ui_out_field_stream (uiout, "ascii", stream);
>  > >  >        }
>  > >  > -    ui_out_tuple_end (uiout);
>  > >  > +    do_cleanups (cleanup2);
>  > >  >        }
>  > >  >      ui_out_stream_delete (stream);
>  > >  > -    ui_out_list_end (uiout);
>  > >  > +    do_cleanups (cleanup1);
>  > >  >    }
>  > >  >    do_cleanups (cleanups);
>  > >  >    return MI_CMD_DONE;
>  > >  > @@ -1415,17 +1418,18 @@
>  > >  >               strcmp (previous_sect_name, section_name) : 1);
>  > >  >    if (new_section)
>  > >  >      {
>  > >  > +      struct cleanup *cleanups;
>  > >  >        xfree (previous_sect_name);
>  > >  >        previous_sect_name = xstrdup (section_name);
>  > >  >
>  > >  >        if (last_async_command)
>  > >  >      fputs_unfiltered (last_async_command, raw_stdout);
>  > >  >        fputs_unfiltered ("+download", raw_stdout);
>  > >  > -      ui_out_tuple_begin (uiout, NULL);
>  > >  > +      cleanups = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
>  > >  >        ui_out_field_string (uiout, "section", section_name);
>  > >  >        ui_out_field_int (uiout, "section-size", total_section);
>  > >  >        ui_out_field_int (uiout, "total-size", grand_total);
>  > >  > -      ui_out_tuple_end (uiout);
>  > >  > +      do_cleanups (cleanups);
>  > >  >        mi_out_put (uiout, raw_stdout);
>  > >  >        fputs_unfiltered ("\n", raw_stdout);
>  > >  >        gdb_flush (raw_stdout);
>  > >  > @@ -1434,18 +1438,19 @@
>  > >  >    if (delta.tv_sec >= update_threshold.tv_sec &&
>  > >  >        delta.tv_usec >= update_threshold.tv_usec)
>  > >  >      {
>  > >  > +      struct cleanup *cleanups;
>  > >  >        last_update.tv_sec = time_now.tv_sec;
>  > >  >        last_update.tv_usec = time_now.tv_usec;
>  > >  >        if (last_async_command)
>  > >  >      fputs_unfiltered (last_async_command, raw_stdout);
>  > >  >        fputs_unfiltered ("+download", raw_stdout);
>  > >  > -      ui_out_tuple_begin (uiout, NULL);
>  > >  > +      cleanups = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
>  > >  >        ui_out_field_string (uiout, "section", section_name);
>  > >  >        ui_out_field_int (uiout, "section-sent", sent_so_far);
>  > >  >        ui_out_field_int (uiout, "section-size", total_section);
>  > >  >        ui_out_field_int (uiout, "total-sent", total_sent);
>  > >  >        ui_out_field_int (uiout, "total-size", grand_total);
>  > >  > -      ui_out_tuple_end (uiout);
>  > >  > +      do_cleanups (cleanups);
>  > >  >        mi_out_put (uiout, raw_stdout);
>  > >  >        fputs_unfiltered ("\n", raw_stdout);
>  > >  >        gdb_flush (raw_stdout);

[-- Attachment #2: 680.realpatch --]
[-- Type: text/plain, Size: 8365 bytes --]

Index: mi/mi-cmd-stack.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-cmd-stack.c,v
retrieving revision 1.11
diff -u -r1.11 mi-cmd-stack.c
--- mi/mi-cmd-stack.c	5 Apr 2002 22:04:43 -0000	1.11
+++ mi/mi-cmd-stack.c	23 Oct 2002 21:13:42 -0000
@@ -45,6 +45,7 @@
   int frame_low;
   int frame_high;
   int i;
+  struct cleanup *cleanup_stack;
   struct frame_info *fi;
 
   if (!target_has_stack)
@@ -76,7 +77,7 @@
   if (fi == NULL)
     error ("mi_cmd_stack_list_frames: Not enough frames in stack.");
 
-  ui_out_list_begin (uiout, "stack");
+  cleanup_stack = make_cleanup_ui_out_list_begin_end (uiout, "stack");
 
   /* Now let;s print the frames up to frame_high, or until there are
      frames in the stack. */
@@ -95,7 +96,7 @@
 			0 /* args */ );
     }
 
-  ui_out_list_end (uiout);
+  do_cleanups (cleanup_stack);
   if (i < frame_high)
     error ("mi_cmd_stack_list_frames: Not enough frames in stack.");
 
@@ -155,6 +156,7 @@
   int frame_high;
   int i;
   struct frame_info *fi;
+  struct cleanup *cleanup_stack_args;
 
   if (argc < 1 || argc > 3 || argc == 2)
     error ("mi_cmd_stack_list_args: Usage: PRINT_VALUES [FRAME_LOW FRAME_HIGH]");
@@ -182,7 +184,7 @@
   if (fi == NULL)
     error ("mi_cmd_stack_list_args: Not enough frames in stack.");
 
-  ui_out_list_begin (uiout, "stack-args");
+  cleanup_stack_args = make_cleanup_ui_out_list_begin_end (uiout, "stack-args");
 
   /* Now let's print the frames up to frame_high, or until there are
      frames in the stack. */
@@ -190,14 +192,15 @@
        fi && (i <= frame_high || frame_high == -1);
        i++, fi = get_prev_frame (fi))
     {
+      struct cleanup *cleanup_frame;
       QUIT;
-      ui_out_tuple_begin (uiout, "frame");
+      cleanup_frame = make_cleanup_ui_out_tuple_begin_end (uiout, "frame");
       ui_out_field_int (uiout, "level", i);
       list_args_or_locals (0, atoi (argv[0]), fi);
-      ui_out_tuple_end (uiout);
+      do_cleanups (cleanup_frame);
     }
 
-  ui_out_list_end (uiout);
+  do_cleanups (cleanup_stack_args);
   if (i < frame_high)
     error ("mi_cmd_stack_list_args: Not enough frames in stack.");
 
@@ -214,13 +217,14 @@
   struct block *block;
   struct symbol *sym;
   int i, nsyms;
+  struct cleanup *cleanup_list;
   static struct ui_stream *stb = NULL;
 
   stb = ui_out_stream_new (uiout);
 
   block = get_frame_block (fi, 0);
 
-  ui_out_list_begin (uiout, locals ? "locals" : "args");
+  cleanup_list = make_cleanup_ui_out_list_begin_end (uiout, locals ? "locals" : "args");
 
   while (block != 0)
     {
@@ -262,8 +266,10 @@
 	    }
 	  if (print_me)
 	    {
+	      struct cleanup *cleanup_tuple = NULL;
 	      if (values)
-		ui_out_tuple_begin (uiout, NULL);
+		cleanup_tuple = 
+		  make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
 	      ui_out_field_string (uiout, "name", SYMBOL_NAME (sym));
 
 	      if (values)
@@ -278,7 +284,7 @@
 		    sym2 = sym;
 		  print_variable_value (sym2, fi, stb->stream);
 		  ui_out_field_stream (uiout, "value", stb);
-		  ui_out_tuple_end (uiout);
+		  do_cleanups (cleanup_tuple);
 		}
 	    }
 	}
@@ -287,7 +293,7 @@
       else
 	block = BLOCK_SUPERBLOCK (block);
     }
-  ui_out_list_end (uiout);
+  do_cleanups (cleanup_list);
   ui_out_stream_delete (stb);
 }
 
Index: mi/mi-cmd-var.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-cmd-var.c,v
retrieving revision 1.13
diff -u -r1.13 mi-cmd-var.c
--- mi/mi-cmd-var.c	3 Oct 2002 20:02:13 -0000	1.13
+++ mi/mi-cmd-var.c	23 Oct 2002 21:13:42 -0000
@@ -254,6 +254,7 @@
   struct varobj *var;
   struct varobj **childlist;
   struct varobj **cc;
+  struct cleanup *cleanup_children;
   int numchild;
   char *type;
 
@@ -271,11 +272,12 @@
   if (numchild <= 0)
     return MI_CMD_DONE;
 
-  ui_out_tuple_begin (uiout, "children");
+  cleanup_children = make_cleanup_ui_out_tuple_begin_end (uiout, "children");
   cc = childlist;
   while (*cc != NULL)
     {
-      ui_out_tuple_begin (uiout, "child");
+      struct cleanup *cleanup_child;
+      cleanup_child = make_cleanup_ui_out_tuple_begin_end (uiout, "child");
       ui_out_field_string (uiout, "name", varobj_get_objname (*cc));
       ui_out_field_string (uiout, "exp", varobj_get_expression (*cc));
       ui_out_field_int (uiout, "numchild", varobj_get_num_children (*cc));
@@ -283,10 +285,10 @@
       /* C++ pseudo-variables (public, private, protected) do not have a type */
       if (type)
 	ui_out_field_string (uiout, "type", varobj_get_type (*cc));
-      ui_out_tuple_end (uiout);
+      do_cleanups (cleanup_child);
       cc++;
     }
-  ui_out_tuple_end (uiout);
+  do_cleanups (cleanup_children);
   xfree (childlist);
   return MI_CMD_DONE;
 }
Index: mi/mi-main.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-main.c,v
retrieving revision 1.34
diff -u -r1.34 mi-main.c
--- mi/mi-main.c	22 Oct 2002 17:53:42 -0000	1.34
+++ mi/mi-main.c	23 Oct 2002 21:13:42 -0000
@@ -915,19 +915,22 @@
   /* Build the result as a two dimentional table. */
   {
     struct ui_stream *stream = ui_out_stream_new (uiout);
+    struct cleanup *cleanup_list_memory;
     int row;
     int row_byte;
-    ui_out_list_begin (uiout, "memory");
+    cleanup_list_memory = make_cleanup_ui_out_list_begin_end (uiout, "memory");
     for (row = 0, row_byte = 0;
 	 row < nr_rows;
 	 row++, row_byte += nr_cols * word_size)
       {
 	int col;
 	int col_byte;
-	ui_out_tuple_begin (uiout, NULL);
+	struct cleanup *cleanup_tuple;
+	struct cleanup *cleanup_list_data;
+	cleanup_tuple = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
 	ui_out_field_core_addr (uiout, "addr", addr + row_byte);
 	/* ui_out_field_core_addr_symbolic (uiout, "saddr", addr + row_byte); */
-	ui_out_list_begin (uiout, "data");
+	cleanup_list_data = make_cleanup_ui_out_list_begin_end (uiout, "data");
 	for (col = 0, col_byte = row_byte;
 	     col < nr_cols;
 	     col++, col_byte += word_size)
@@ -944,7 +947,7 @@
 		ui_out_field_stream (uiout, NULL, stream);
 	      }
 	  }
-	ui_out_list_end (uiout);
+	do_cleanups (cleanup_list_data);
 	if (aschar)
 	  {
 	    int byte;
@@ -964,10 +967,10 @@
 	      }
 	    ui_out_field_stream (uiout, "ascii", stream);
 	  }
-	ui_out_tuple_end (uiout);
+	do_cleanups (cleanup_tuple);
       }
     ui_out_stream_delete (stream);
-    ui_out_list_end (uiout);
+    do_cleanups (cleanup_list_memory);
   }
   do_cleanups (cleanups);
   return MI_CMD_DONE;
@@ -1419,17 +1422,18 @@
 		 strcmp (previous_sect_name, section_name) : 1);
   if (new_section)
     {
+      struct cleanup *cleanup_tuple;
       xfree (previous_sect_name);
       previous_sect_name = xstrdup (section_name);
 
       if (last_async_command)
 	fputs_unfiltered (last_async_command, raw_stdout);
       fputs_unfiltered ("+download", raw_stdout);
-      ui_out_tuple_begin (uiout, NULL);
+      cleanup_tuple = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
       ui_out_field_string (uiout, "section", section_name);
       ui_out_field_int (uiout, "section-size", total_section);
       ui_out_field_int (uiout, "total-size", grand_total);
-      ui_out_tuple_end (uiout);
+      do_cleanups (cleanup_tuple);
       mi_out_put (uiout, raw_stdout);
       fputs_unfiltered ("\n", raw_stdout);
       gdb_flush (raw_stdout);
@@ -1438,18 +1442,19 @@
   if (delta.tv_sec >= update_threshold.tv_sec &&
       delta.tv_usec >= update_threshold.tv_usec)
     {
+      struct cleanup *cleanup_tuple;
       last_update.tv_sec = time_now.tv_sec;
       last_update.tv_usec = time_now.tv_usec;
       if (last_async_command)
 	fputs_unfiltered (last_async_command, raw_stdout);
       fputs_unfiltered ("+download", raw_stdout);
-      ui_out_tuple_begin (uiout, NULL);
+      cleanup_tuple = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
       ui_out_field_string (uiout, "section", section_name);
       ui_out_field_int (uiout, "section-sent", sent_so_far);
       ui_out_field_int (uiout, "section-size", total_section);
       ui_out_field_int (uiout, "total-sent", total_sent);
       ui_out_field_int (uiout, "total-size", grand_total);
-      ui_out_tuple_end (uiout);
+      do_cleanups (cleanup_tuple);
       mi_out_put (uiout, raw_stdout);
       fputs_unfiltered ("\n", raw_stdout);
       gdb_flush (raw_stdout);

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2002-10-23 21:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-10 14:03 patch for gdb/mi 680 J. Johnston
2002-10-21 16:06 ` Elena Zannoni
2002-10-21 16:08 ` Elena Zannoni
2002-10-21 16:34   ` J. Johnston
2002-10-22  7:20     ` Elena Zannoni
2002-10-23 14:20       ` J. Johnston
2002-10-21 18:13   ` Andrew Cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox