Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Gordon Prieur <Gordon.Prieur@Sun.COM>
Cc: gdb@sourceware.org
Subject: Re: Question about when stdout is flushed in gdb/mi mode
Date: Tue, 19 Feb 2008 18:20:00 -0000	[thread overview]
Message-ID: <20080219180233.GA4631@caradoc.them.org> (raw)
In-Reply-To: <47BB0490.6070703@sun.com>

On Tue, Feb 19, 2008 at 08:32:16AM -0800, Gordon Prieur wrote:
> Hi,
>
>    If I do several printf command before a breakpoint in normal
> command line gdb, the stdout gets flushed prior to showing the stop
> message in gdb. If I do the same thing in mi mode from a tty, I get
> the same results. But if I do this from NetBeans (where gdb isn't
> running in a tty), the output doesn't get flushed and hence doesn't
> get shown before the stop.

Yes.  By default, stdout is line buffered in TTYs and block buffered
otherwise.  On pipes, or Cygwin terminals with a mingw32 GDB (where
isatty returns false), stdout ends up block buffered.  This applies to
both GDB's stdout and the program being debugged.

GDB never, ever flushes the stdout of the program being debugged.
That would be a real pain if it affected anything you were debugging,
because the buffering is done in the C library, not in the kernel.

You can run the program being debugged in a new TTY, for instance with
"set tty".

-- 
Daniel Jacobowitz
CodeSourcery


      parent reply	other threads:[~2008-02-19 18:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-19 16:39 Gordon Prieur
2008-02-19 17:52 ` Dave Korn
2008-02-19 18:20 ` Daniel Jacobowitz [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=20080219180233.GA4631@caradoc.them.org \
    --to=drow@false.org \
    --cc=Gordon.Prieur@Sun.COM \
    --cc=gdb@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