Re: [PATCH 1/3] Detect GDB is in cygwin

Yao Qi
2013-08-16T01:07:04Z

On 08/16/2013 01:40 AM, Christopher Faylor wrote:
> You've already acknowledged that your code will decide to become
> unbuffered whether you are running on a cygwin pipe or cygwin pty. What
> is special about cygwin pipes that makes you want to make them
> unbuffered while ignoring normal Windows pipes?

In a cygwin session, I start gdb "./gdb", and stdin is a cygwin pty. If
I start gdb "echo yes | ./gdb", stdin is a cygwin pipe, right?

In a windows console (cmd.exe), if I start gdb "echo yes | ./gdb", stdin
is a windows pipe. Is it correct?

>
> Can you explain*why* you don't want to change the behavior on native
> windows?

because the problem this patch series want to address is not related to
native windows, so we don't want to change its behaviour. We think
"buffered/unbuffered" are user visible behaviour, and we should be
careful on changing them.

The original problem this patch series want to address is about testing
mingw32 native gdb in cygwin. This patch series can make
dejagnu/testsuite happy, and improve the test result dramatically
(without this patch series, the result is unusable at all).

If Pierre or some one else thinks we need changes here on native
windows, that is fine, let us do it. There are many issues for mingw,
cygwin and windows, and it is impossible to fix all of them in one patch
series. This patch series make some progresses and Pierre's incoming
RCF will make some progresses too, isn't it what we want?

>
> I really don't like having gdb rely on undocumented Cygwin behavior.
> You're introducing a tenuous dependency between the way Cygwin creates
> ptys and pipes which could easily break if we decide to change something
> in Cygwin.

GDB has been relying on undocumented behaviours here and there.
'grep "no.*document" *.c" may find some. If the file name pattern of
ptys and pipes are changed some day, we can update the code here to
match, which is not difficult, IMO.

On the other hand, do you think it is hard to get this documented in
Cygwin? in order to improve the interoperability between Cygwin and GDB.

--
Yao (é½å°§)