This is the mail archive of the
insight@sources.redhat.com
mailing list for the Insight project.
Re: Flawed patch to capture inferior output
- To: Tom Tromey <tromey at redhat dot com>
- Subject: Re: Flawed patch to capture inferior output
- From: Christopher Faylor <cgf at redhat dot com>
- Date: Sat, 6 Oct 2001 23:40:07 -0400
- Cc: Insight List <insight at sources dot redhat dot com>
- References: <87bsjky09n.fsf@creche.redhat.com>
On Sat, Oct 06, 2001 at 02:35:48PM -0600, Tom Tromey wrote:
>Today I wrote a simple patch that arranges for the inferior's stdout
>and stderr to end up in the Console window. This patch also makes it
>possible to run insight in the background -- something I've wanted for
>a long time.
>
>Unfortunately this patch has an undesirable side effect. Since the
>inferior's stdout/stderr are now pipes and not terminals, by default
>they are given full, and not line, buffering (at least, that is
>consistent with what I see when debugging). This makes this feature
>much less useful, as output from the inferior doesn't show up until it
>is flushed.
>
>One way to fix this flaw would be to change gdbtk_redirect_io to
>create a new terminal and then use the slave side as the inferior's
>new stdout/stderr. This looks hard enough that I'm not going to
>attempt it.
By "terminal" do you mean pty? It seems to me that redirecting I/O to a
pipe could have all sorts of negative consequences for programs that
expect to be running under a tty. Redirecting to a pty, however, should
be pretty transparent.
The hard part is accomodating the various types of pty access methods
out there but there should be generic software around that opens a pty
in a way similar to a pipe and does the equivalent of a popen().
Using ptys would mean that you couldn't use this feature on MS-DOS or
straight windows but it should work fine under Cygwin.
cgf