2004-01-06 Jeff Johnston <jjohnstn@redhat.com>
authorJeff Johnston <jjohnstn@redhat.com>
Tue, 6 Jan 2004 19:06:39 +0000 (19:06 +0000)
committerJeff Johnston <jjohnstn@redhat.com>
Tue, 6 Jan 2004 19:06:39 +0000 (19:06 +0000)
        * disasm.c: Update copyright to include 2004.
        (do_mixed_source_and_assembly): For uiout asm list
        and tuple cleanups, initialize to null_cleanup instead of
        NULL and do so prior to loop.  Only reset when we close off
        the tuple/list.  Move check for whether to close off the
        asm tuple/list to after dump_insns call where it will be run
        on each loop iteration.

gdb/ChangeLog
gdb/disasm.c

index 2152f27c5b238c46389e96f3a640f539b856b83f..896d3576e9339c7cae705f61b766fbc609537460 100644 (file)
@@ -1,3 +1,13 @@
+2004-01-06  Jeff Johnston  <jjohnstn@redhat.com>
+
+       * disasm.c: Update copyright to include 2004.
+       (do_mixed_source_and_assembly): For uiout asm list
+       and tuple cleanups, initialize to null_cleanup instead of
+       NULL and do so prior to loop.  Only reset when we close off 
+       the tuple/list.  Move check for whether to close off the
+       asm tuple/list to after dump_insns call where it will be run 
+       on each loop iteration.
+
 2004-01-05  Andrew Cagney  <cagney@redhat.com>
 
        * ser-unix.c (ser_unix_async): Fix tipo, "NOTHING_SECHEDULED"
index 20d0ab3404bf98a36f6b1dbc614c2b78bb6cd93d..3cde2ea904023868201eac9d27da6f7edd93c042 100644 (file)
@@ -1,6 +1,6 @@
 /* Disassemble support for GDB.
 
-   Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+   Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -164,6 +164,8 @@ do_mixed_source_and_assembly (struct ui_out *uiout,
   CORE_ADDR pc;
   int num_displayed = 0;
   struct cleanup *ui_out_chain;
+  struct cleanup *ui_out_tuple_chain = make_cleanup (null_cleanup, 0);
+  struct cleanup *ui_out_list_chain = make_cleanup (null_cleanup, 0);
 
   mle = (struct dis_line_entry *) alloca (nlines
                                          * sizeof (struct dis_line_entry));
@@ -221,10 +223,6 @@ do_mixed_source_and_assembly (struct ui_out *uiout,
 
   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)
        {
@@ -275,23 +273,23 @@ do_mixed_source_and_assembly (struct ui_out *uiout,
          next_line = mle[i].line + 1;
          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;
        }
 
       num_displayed += dump_insns (uiout, di, mle[i].start_pc, mle[i].end_pc,
                                   how_many, stb);
-      if (close_list)
+
+      /* When we've reached the end of the mle array, or we've seen the last
+         assembly range for this source line, close out the list/tuple.  */
+      if (i == (newlines - 1) || mle[i + 1].line > mle[i].line)
        {
          do_cleanups (ui_out_list_chain);
          do_cleanups (ui_out_tuple_chain);
+         ui_out_tuple_chain = make_cleanup (null_cleanup, 0);
+         ui_out_list_chain = make_cleanup (null_cleanup, 0);
          ui_out_text (uiout, "\n");
-         close_list = 0;
        }
-      if (how_many >= 0)
-       if (num_displayed >= how_many)
-         break;
+      if (how_many >= 0 && num_displayed >= how_many)
+       break;
     }
   do_cleanups (ui_out_chain);
 }
This page took 0.027942 seconds and 4 git commands to generate.