]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* utils.c (prompt_for_continue): Reinitialize more-counts
authorJohn Gilmore <gnu@cygnus>
Thu, 17 Sep 1992 10:58:53 +0000 (10:58 +0000)
committerJohn Gilmore <gnu@cygnus>
Thu, 17 Sep 1992 10:58:53 +0000 (10:58 +0000)
before printing anything, and again afterward.  Fix comments.
(vfprintf_filtered):  Eliminate static buffer; use auto buffer,
or alloca() if needed.

* rs6000-xdep.c:  Use correct conditional (IBM6000_TARGET) to
detect native versus cross-host.

gdb/ChangeLog
gdb/rs6000-xdep.c
gdb/utils.c

index 5d17d86b6ab09fe0b73618d6c82584081e844272..b4a1b81e5f63b15ce371fe5fd4b74387ca335618 100644 (file)
@@ -1,3 +1,13 @@
+Thu Sep 17 03:49:59 1992  John Gilmore  (gnu@cygnus.com)
+
+       * utils.c (prompt_for_continue):  Reinitialize more-counts
+       before printing anything, and again afterward.  Fix comments.
+       (vfprintf_filtered):  Eliminate static buffer; use auto buffer,
+       or alloca() if needed.
+
+       * rs6000-xdep.c:  Use correct conditional (IBM6000_TARGET) to
+       detect native versus cross-host.
+
 Wed Sep 16 21:57:14 1992  Stu Grossman  (grossman at cygnus.com)
 
        * m68k-tdep.c (sun3_saved_pc_after_call):  Only do trap check for
index a80ee147d7af51dee9c13d164a5812ae7778a0af..5524826a897ad5afb8727291cfd81a342ace6ab9 100644 (file)
@@ -23,7 +23,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include "symtab.h"
 #include "target.h"
 
-#ifdef RS6000_TARGET
+#ifdef IBM6000_TARGET
 
 #include <sys/param.h>
 #include <sys/dir.h>
@@ -253,7 +253,7 @@ exec_one_dummy_insn ()
 }
 
 
-#else /* RS6000_TARGET */
+#else /* IBM6000_TARGET */
 
 /* FIXME: Kludge this til we separate host vs. target vs. native code. */
 
@@ -278,4 +278,4 @@ fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
 {
 }
 
-#endif /* RS6000_TARGET */
+#endif /* IBM6000_TARGET */
index e61b3d68aea8e05d8d2d1df427c5281a6e03666d..6ad26648bdfb96e5c5ede35bea167fbc1d288dc0 100644 (file)
@@ -900,17 +900,29 @@ set_width_command (args, from_tty, c)
   wrap_pointer = wrap_buffer;  /* Start it at the beginning */
 }
 
+/* Wait, so the user can read what's on the screen.  Prompt the user
+   to continue by pressing RETURN.  */
+
 static void
 prompt_for_continue ()
 {
   char *ignore;
 
+  /* We must do this *before* we call gdb_readline, else it will eventually
+     call us -- thinking that we're trying to print beyond the end of the 
+     screen.  */
+  reinitialize_more_filter ();
+
   immediate_quit++;
   ignore = gdb_readline ("---Type <return> to continue---");
   if (ignore)
     free (ignore);
-  chars_printed = lines_printed = 0;
   immediate_quit--;
+
+  /* Now we have to do this again, so that GDB will know that it doesn't
+     need to save the ---Type <return>--- line at the top of the screen.  */
+  reinitialize_more_filter ();
+
   dont_repeat ();              /* Forget prev cmd -- CR won't repeat it. */
 }
 
@@ -1151,7 +1163,7 @@ fputs_demangled (linebuffer, stream, arg_mode)
 
 /* Print a variable number of ARGS using format FORMAT.  If this
    information is going to put the amount written (since the last call
-   to INITIALIZE_MORE_FILTER or the last page break) over the page size,
+   to REINITIALIZE_MORE_FILTER or the last page break) over the page size,
    print out a pause message and do a gdb_readline to get the users
    permision to continue.
 
@@ -1172,36 +1184,26 @@ fputs_demangled (linebuffer, stream, arg_mode)
    (since prompt_for_continue may do so) so this routine should not be
    called when cleanups are not in place.  */
 
+#define        MIN_LINEBUF     255
+
 void
 vfprintf_filtered (stream, format, args)
      FILE *stream;
      char *format;
      va_list args;
 {
-  static char *linebuffer = (char *) 0;
-  static int line_size;
+  char line_buf[MIN_LINEBUF+10];
+  char *linebuffer = line_buf;
   int format_length;
 
   format_length = strlen (format);
 
-  /* Allocated linebuffer for the first time.  */
-  if (!linebuffer)
-    {
-      linebuffer = (char *) xmalloc (255);
-      line_size = 255;
-    }
-
   /* Reallocate buffer to a larger size if this is necessary.  */
-  if (format_length * 2 > line_size)
+  if (format_length * 2 > MIN_LINEBUF)
     {
-      line_size = format_length * 2;
-
-      /* You don't have to copy.  */
-      free (linebuffer);
-      linebuffer = (char *) xmalloc (line_size);
+      linebuffer = alloca (10 + format_length * 2);
     }
 
-
   /* This won't blow up if the restrictions described above are
      followed.   */
   vsprintf (linebuffer, format, args);