aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2022-01-03 17:12:22 -0700
committerTom Tromey <tom@tromey.com>2022-03-29 12:46:25 -0600
commitebfc93611b641bae0ca3ecca2ba20c7d677968b9 (patch)
tree380ceb8c66bc8807d5396a64b4632b2b319783f2
parent6b0c1154230afc0bf878993f11154dd0b3adda1a (diff)
downloadgdb-ebfc93611b641bae0ca3ecca2ba20c7d677968b9.zip
gdb-ebfc93611b641bae0ca3ecca2ba20c7d677968b9.tar.gz
gdb-ebfc93611b641bae0ca3ecca2ba20c7d677968b9.tar.bz2
Remove unnecessary calls to wrap_here and gdb_flush
Various spots in gdb currently know about the wrap buffer, and so are careful to call wrap_here to be certain that all output has been flushed. Now that the pager is just an ordinary stream, this isn't needed, and a simple call to gdb_flush is enough. Similarly, there are places where gdb prints to gdb_stderr, but first flushes gdb_stdout. stderr_file already flushes gdb_stdout, so these aren't needed.
-rw-r--r--gdb/cli/cli-cmds.c1
-rw-r--r--gdb/exceptions.c10
-rw-r--r--gdb/main.c4
-rw-r--r--gdb/printcmd.c1
-rw-r--r--gdb/psymtab.c1
-rw-r--r--gdb/top.c1
-rw-r--r--gdb/utils.c6
7 files changed, 3 insertions, 21 deletions
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index 6a03f25..e12ccee 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -846,7 +846,6 @@ echo_command (const char *text, int from_tty)
gdb_stdout->reset_style ();
/* Force this output to appear now. */
- gdb_stdout->wrap_here (0);
gdb_flush (gdb_stdout);
}
diff --git a/gdb/exceptions.c b/gdb/exceptions.c
index 64a3627..fdb65b3 100644
--- a/gdb/exceptions.c
+++ b/gdb/exceptions.c
@@ -46,19 +46,15 @@ print_flush (void)
}
/* We want all output to appear now, before we print the error. We
- have 3 levels of buffering we have to flush (it's possible that
+ have 2 levels of buffering we have to flush (it's possible that
some of these should be changed to flush the lower-level ones
too): */
- /* 1. The _filtered buffer. */
- if (filtered_printing_initialized ())
- gdb_stdout->wrap_here (0);
-
- /* 2. The stdio buffer. */
+ /* 1. The stdio buffer. */
gdb_flush (gdb_stdout);
gdb_flush (gdb_stderr);
- /* 3. The system-level buffer. */
+ /* 2. The system-level buffer. */
gdb_stdout_serial = serial_fdopen (fileno (ui->outstream));
if (gdb_stdout_serial)
{
diff --git a/gdb/main.c b/gdb/main.c
index 0723ea4..acb7a45 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -1124,7 +1124,6 @@ captured_main_1 (struct captured_main_args *context)
if (print_version)
{
print_gdb_version (gdb_stdout, false);
- gdb_stdout->wrap_here (0);
gdb_printf ("\n");
exit (0);
}
@@ -1138,7 +1137,6 @@ captured_main_1 (struct captured_main_args *context)
if (print_configuration)
{
print_gdb_configuration (gdb_stdout);
- gdb_stdout->wrap_here (0);
gdb_printf ("\n");
exit (0);
}
@@ -1154,7 +1152,6 @@ captured_main_1 (struct captured_main_args *context)
print_gdb_version (gdb_stdout, true);
if (symarg)
gdb_printf ("..");
- gdb_stdout->wrap_here (0);
gdb_printf ("\n");
gdb_flush (gdb_stdout); /* Force to screen during slow
operations. */
@@ -1175,7 +1172,6 @@ captured_main_1 (struct captured_main_args *context)
print_gdb_version (gdb_stdout, true);
if (symarg)
gdb_printf ("..");
- gdb_stdout->wrap_here (0);
gdb_printf ("\n");
gdb_flush (gdb_stdout); /* Force to screen during slow
operations. */
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 396d1fe..3930d08 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -1493,7 +1493,6 @@ output_command (const char *exp, int from_tty)
annotate_value_end ();
- gdb_stdout->wrap_here (0);
gdb_flush (gdb_stdout);
}
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index a3aa4ae..b31ce87 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -1426,7 +1426,6 @@ partial_symtab::expand_dependencies (struct objfile *objfile)
gdb_puts ("and ");
gdb_stdout->wrap_here (0);
gdb_printf ("%s...", dependencies[i]->filename);
- gdb_stdout->wrap_here (0); /* Flush output */
gdb_flush (gdb_stdout);
}
dependencies[i]->expand_psymtab (objfile);
diff --git a/gdb/top.c b/gdb/top.c
index 05b2b43..a28e72f 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -1358,7 +1358,6 @@ command_line_input (const char *prompt_arg, const char *annotation_suffix)
/* Make sure that all output has been output. Some machines may
let you get away with leaving out some of the gdb_flush, but
not all. */
- gdb_stdout->wrap_here (0);
gdb_flush (gdb_stdout);
gdb_flush (gdb_stderr);
diff --git a/gdb/utils.c b/gdb/utils.c
index 8d3a89c..2df9b1d 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -146,9 +146,6 @@ vwarning (const char *string, va_list args)
term_state.emplace ();
target_terminal::ours_for_output ();
}
- if (filtered_printing_initialized ())
- gdb_stdout->wrap_here (0); /* Force out any buffered output. */
- gdb_flush (gdb_stdout);
if (warning_pre_print)
gdb_puts (warning_pre_print, gdb_stderr);
gdb_vprintf (gdb_stderr, string, args);
@@ -650,9 +647,6 @@ void
print_sys_errmsg (const char *string, int errcode)
{
const char *err = safe_strerror (errcode);
- /* We want anything which was printed on stdout to come out first, before
- this message. */
- gdb_flush (gdb_stdout);
gdb_printf (gdb_stderr, "%s: %s.\n", string, err);
}