Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: Tom Tromey <tromey@adacore.com>
Cc: Pedro Alves <palves@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH] Remove excess calls to gdb_flush
Date: Thu, 07 Mar 2019 06:06:00 -0000	[thread overview]
Message-ID: <20190307060601.GB26408@adacore.com> (raw)
In-Reply-To: <87k1hdtdf0.fsf@tromey.com>

> >>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
> 
> Pedro> On 02/19/2019 08:54 PM, Tom Tromey wrote:
> >> 
> >> my belief being that gdb's standard output
> >> streams are line buffered (by inheriting the behavior from stdio)
> 
> Pedro> That's only true if gdb is connected to a pty.  If gdb is started with
> Pedro> a pipe or regular file for stdout/stderr instead, then it won't be.  I
> Pedro> guess we could fix that with a setvbuf call at startup though.
> 
> I'll take a look.

I think the scenario being discussed here is slightly different
from what the diff below is for, but I thought I'd mention it,
just in case. At AdaCore, we have the following local change:

--- a/gdb/main.c
+++ b/gdb/main.c
@@ -527,6 +527,17 @@ captured_main_1 (struct captured_main_args *context)
     error (_("fatal error: libbfd ABI mismatch"));

 #ifdef __MINGW32__
+  /* On Windows hosts, when built using MinGW, we have some problems
+     with the terminal when running the debugger either under a cygwin
+     environment, or when connected to a GUI: When the debugger prints
+     an error, the actual printing on screen of the error message is
+     delayed and only finally printed after the next GDB prompt.
+     We avoid this issue by turning off buffering of stdout and stderr.  */
+  setvbuf (stdout, NULL, _IONBF, 0);
+  setvbuf (stderr, NULL, _IONBF, 0);
+#endif
+
+#ifdef __MINGW32__
   /* On Windows, argv[0] is not necessarily set to absolute form when
      GDB is found along PATH, without which relocation doesn't work.  */
   gdb_program_name = windows_get_absolute_argv0 (argv[0]);


-- 
Joel


      reply	other threads:[~2019-03-07  6:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-19 20:54 Tom Tromey
2019-02-19 22:12 ` Kevin Buettner
2019-03-05 15:56   ` Tom Tromey
2019-03-05 17:06 ` Pedro Alves
2019-03-05 17:54   ` Tom Tromey
2019-03-07  6:06     ` Joel Brobecker [this message]

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=20190307060601.GB26408@adacore.com \
    --to=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    --cc=tromey@adacore.com \
    /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