This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Unbuffer stdout and stderr on windows


> Date: Fri, 16 Aug 2013 14:30:20 +0100
> From: Pedro Alves <palves@redhat.com>
> CC: gdb-patches@sourceware.org, brobecker@adacore.com, yao@codesourcery.com
> 
> So how is emacs starting GDB?

Via a pipe, of course.  How else could Emacs read what GDB outputs and
interpret it?

> If it is started in a pipe, then what is forcing flushing at line
> ends so that emacs doesn't break?

Emacs has a special machinery to decode EOLs correctly even if input
ends in a CR, and the NL comes later.  But this machinery is
heuristics and it's fragile.  Right now, the amount of such "broken"
outputs is usually very small, and the fact that GDB flushes its
stdout probably makes it negligibly small.  If we cause more of these
instances to happen, the probability of a failure in a given session
will go up.

> IOW, the testsuite is not special, in that if emacs starts
> GDB with io connected to pipes, then it should be having the
> exact same issues the testsuite has.

The test suite is special, AFAIU.  The original problem was not with
buffering, it was with mixing stdout and stderr that confused Expect.
An Emacs (human) user will never be confused by any such mix, and I
believe MI output makes the mix improbable.

In any case, I heard no complaints about any such situations, nor did
I ever see that myself.

> We do have "gdb_flush (gdb_stdout)" calls sprinkled through the
> tree.  If that is what makes emacs+pipe work, then OK, we can remain
> with stdout fully buffered, but then I'd say that the bug is that
> there are places that miss gdb_flush calls.

Maybe we should dig deeper in the original problem as well, because I
still have only a very vague notion of why would GDB, which is a
single-threaded program, cause mixing when it flushes stdout
regularly.  What am I missing?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]