* 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.
This commit is contained in:
John Gilmore 1992-09-17 10:58:53 +00:00
parent f499253491
commit d974236f80
3 changed files with 33 additions and 21 deletions

View 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) 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 * m68k-tdep.c (sun3_saved_pc_after_call): Only do trap check for

View file

@ -23,7 +23,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "symtab.h" #include "symtab.h"
#include "target.h" #include "target.h"
#ifdef RS6000_TARGET #ifdef IBM6000_TARGET
#include <sys/param.h> #include <sys/param.h>
#include <sys/dir.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. */ /* 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 */

View file

@ -900,17 +900,29 @@ set_width_command (args, from_tty, c)
wrap_pointer = wrap_buffer; /* Start it at the beginning */ 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 static void
prompt_for_continue () prompt_for_continue ()
{ {
char *ignore; 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++; immediate_quit++;
ignore = gdb_readline ("---Type <return> to continue---"); ignore = gdb_readline ("---Type <return> to continue---");
if (ignore) if (ignore)
free (ignore); free (ignore);
chars_printed = lines_printed = 0;
immediate_quit--; 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. */ 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 /* Print a variable number of ARGS using format FORMAT. If this
information is going to put the amount written (since the last call 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 print out a pause message and do a gdb_readline to get the users
permision to continue. 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 (since prompt_for_continue may do so) so this routine should not be
called when cleanups are not in place. */ called when cleanups are not in place. */
#define MIN_LINEBUF 255
void void
vfprintf_filtered (stream, format, args) vfprintf_filtered (stream, format, args)
FILE *stream; FILE *stream;
char *format; char *format;
va_list args; va_list args;
{ {
static char *linebuffer = (char *) 0; char line_buf[MIN_LINEBUF+10];
static int line_size; char *linebuffer = line_buf;
int format_length; int format_length;
format_length = strlen (format); 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. */ /* 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; linebuffer = alloca (10 + format_length * 2);
/* You don't have to copy. */
free (linebuffer);
linebuffer = (char *) xmalloc (line_size);
} }
/* This won't blow up if the restrictions described above are /* This won't blow up if the restrictions described above are
followed. */ followed. */
vsprintf (linebuffer, format, args); vsprintf (linebuffer, format, args);