From d974236f808582b586d34119aba2caa985d173b9 Mon Sep 17 00:00:00 2001 From: John Gilmore Date: Thu, 17 Sep 1992 10:58:53 +0000 Subject: [PATCH] * 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. --- gdb/ChangeLog | 10 ++++++++++ gdb/rs6000-xdep.c | 6 +++--- gdb/utils.c | 38 ++++++++++++++++++++------------------ 3 files changed, 33 insertions(+), 21 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 5d17d86b6ab..b4a1b81e5f6 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -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 diff --git a/gdb/rs6000-xdep.c b/gdb/rs6000-xdep.c index a80ee147d7a..5524826a897 100644 --- a/gdb/rs6000-xdep.c +++ b/gdb/rs6000-xdep.c @@ -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 #include @@ -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 */ diff --git a/gdb/utils.c b/gdb/utils.c index e61b3d68aea..6ad26648bdf 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -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 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 --- 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); -- 2.30.2