public inbox for gdb-cvs@sourceware.org help / color / mirror / Atom feed
From: Tom Tromey <tromey@sourceware.org> To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Remove unnecessary calls to wrap_here and gdb_flush Date: Tue, 29 Mar 2022 19:43:36 +0000 (GMT) [thread overview] Message-ID: <20220329194336.8FC10386EC0E@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ebfc93611b641bae0ca3ecca2ba20c7d677968b9 commit ebfc93611b641bae0ca3ecca2ba20c7d677968b9 Author: Tom Tromey <tom@tromey.com> Date: Mon Jan 3 17:12:22 2022 -0700 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. Diff: --- 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 6a03f25c206..e12ccee2e48 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 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 0723ea4ae65..acb7a45fb7c 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 396d1feda5b..3930d089836 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 a3aa4aeaec4..b31ce877b62 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 05b2b43402e..a28e72f77f3 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 8d3a89cf036..2df9b1d7dcf 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); }
reply other threads:[~2022-03-29 19:43 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20220329194336.8FC10386EC0E@sourceware.org \ --to=tromey@sourceware.org \ --cc=gdb-cvs@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: linkBe 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).