From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [PATCH 19/19] Remove unnecessary calls to wrap_here and gdb_flush
Date: Fri, 21 Jan 2022 18:38:01 -0700 [thread overview]
Message-ID: <20220122013801.666659-20-tom@tromey.com> (raw)
In-Reply-To: <20220122013801.666659-1-tom@tromey.com>
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.
---
gdb/cli/cli-cmds.c | 1 -
gdb/exceptions.c | 10 +++-------
gdb/main.c | 4 ----
gdb/printcmd.c | 1 -
gdb/psymtab.c | 1 -
gdb/top.c | 1 -
gdb/utils.c | 6 ------
7 files changed, 3 insertions(+), 21 deletions(-)
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index 12b078244b9..2deef7fc053 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -841,7 +841,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 64a36273a61..fdb65b3dc4b 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 84d11b7bbc9..418d3a5bc02 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -1121,7 +1121,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);
}
@@ -1135,7 +1134,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);
}
@@ -1151,7 +1149,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. */
@@ -1172,7 +1169,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 2263a4c90ea..02a91ff80e2 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -1498,7 +1498,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 39307d92296..5293f6f750f 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 b8c1618f65d..031f919302a 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -1365,7 +1365,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 0b23e54f185..3d190e08260 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);
}
--
2.31.1
next prev parent reply other threads:[~2022-01-22 1:38 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-22 1:37 [PATCH 00/19] Simplify GDB output functions Tom Tromey
2022-01-22 1:37 ` [PATCH 01/19] Use unfiltered output in annotate.c Tom Tromey
2022-01-22 1:37 ` [PATCH 02/19] Remove some uses of printf_unfiltered Tom Tromey
2022-01-22 1:37 ` [PATCH 03/19] Only have one API for unfiltered output Tom Tromey
2022-01-22 1:37 ` [PATCH 04/19] Add puts_unfiltered method to ui_file Tom Tromey
2022-01-22 1:37 ` [PATCH 05/19] Add style-escape methods " Tom Tromey
2022-01-22 1:37 ` [PATCH 06/19] Remove vfprintf_styled_no_gdbfmt Tom Tromey
2022-01-22 1:37 ` [PATCH 07/19] Change the pager to a ui_file Tom Tromey
2022-01-22 1:37 ` [PATCH 08/19] Remove fputs_styled_unfiltered Tom Tromey
2022-01-22 1:37 ` [PATCH 09/19] Unify vprintf functions Tom Tromey
2022-01-22 1:37 ` [PATCH 10/19] Unify gdb puts functions Tom Tromey
2022-01-22 1:37 ` [PATCH 11/19] Unify gdb putc functions Tom Tromey
2022-01-22 1:37 ` [PATCH 13/19] Rename print_spaces_filtered Tom Tromey
2022-01-22 1:37 ` [PATCH 14/19] Rename puts_filtered_tabular Tom Tromey
2022-01-22 1:37 ` [PATCH 15/19] Rename fprintf_symbol_filtered Tom Tromey
2022-01-22 1:37 ` [PATCH 16/19] Remove ui_out_flag::unfiltered_output Tom Tromey
2022-01-22 1:37 ` [PATCH 17/19] Remove vfprintf_styled Tom Tromey
2022-01-22 1:38 ` [PATCH 18/19] Minor comment updates in utils.h Tom Tromey
2022-03-24 18:05 ` Pedro Alves
2022-03-28 20:29 ` Tom Tromey
2022-01-22 1:38 ` Tom Tromey [this message]
2022-01-22 17:40 ` [PATCH 00/19] Simplify GDB output functions John Baldwin
2022-03-24 16:25 ` Tom Tromey
2022-03-24 18:08 ` Pedro Alves
2022-03-29 19:38 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220122013801.666659-20-tom@tromey.com \
--to=tom@tromey.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).