Re: [RFC] gdb/testsuite/gdb.base/fileio.exp patch for cygwin

Pedro Alves
2007-12-05T22:56:04Z

Pierre Muller wrote:
> I am sorry, Pedro,
> but I am completely unable to reproduce
> your output.
> I always get '1' as a result for all the tests
> I tried running your application.

Blurfh. I first tried doing a make check with the
patch I attached on my previous message, and with a
hacked fileio.c to see what gdb and the inferior
stdin/out/err streams were. The result is something like:

(output a bit different from the previous patch to
make it clearer what is what)

make check RUNTESTFLAGS="--target_board=cygwin fileio.exp"

(...)
spawn
/cygdrive/d/cegccsf/cegcc/cegcc/src/build-gdb_server_cygwin_submit/gdb/testsuite/../../gdb/gdb

-nw -nx
gdb: isatty (0) = 1, ttyname (0) = /dev/tty1
gdb: isatty (1) = 1, ttyname (1) = /dev/tty1
gdb: isatty (2) = 1, ttyname (2) = /dev/tty1
GNU gdb 6.7.50.20071201-cvs
Copyright (C) 2007 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-cygwin".

(...)

(gdb) run
Starting program:
/cygdrive/d/cegccsf/cegcc/cegcc/src/build-gdb_server_cygwin_submit/gdb/testsuite/gdb.base/fileio.exe

Breakpoint 1, main () at
../../../gdb-server_submit/src/gdb/testsuite/gdb.base/fileio.c:546
546 for (i = 0; i < 3; i++)
(gdb) break stop
Breakpoint 2: file
../../../gdb-server_submit/src/gdb/testsuite/gdb.base/fileio.c, line 71.
(gdb) continue
Continuing.
inf: isatty (0) = 0, ttyname (0) = (null)
inf: isatty (1) = 0, ttyname (1) = (null)
inf: isatty (2) = 0, ttyname (2) = (null)

Seeing this, I tried the example standalone/non-dejagnu
test I posted, but with CYGWIN=tty, which produces the
exact same results dejagnu sees.

I then removed 'tty' from CYGWIN, but failed to
restart every cygwin process, which made me fail to
see what you saw. Which shows:

>gdb ./main.exe
gdb: isatty (0) = 1, ttyname (0) = /dev/console
gdb: isatty (1) = 1, ttyname (1) = /dev/console
gdb: isatty (2) = 1, ttyname (2) = /dev/console
GNU gdb 6.7.50.20071201-cvs
Copyright (C) 2007 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-cygwin"...
(gdb) r
Starting program: /home/pedro/isatty/main.exe
inf: isatty (0) = 1, ttyname (0) = /dev/console
inf: isatty (1) = 1, ttyname (1) = /dev/console
inf: isatty (2) = 1, ttyname (2) = /dev/console

Program exited normally.
(gdb)

Which is the behaviour I was expecting:
"I don't know enough of the Cygwin tty support,
but I would expect that if gdb had a (Windows) console
attached (bash started from cmd.exe, not the xterm or rxvt),
the inferior would inherit it, and the runtime would arrange
for the isatty to be true, but that doesn't seem to hold."

Sorry for the confusion.

So, the excelent description Corinna posted applies
to the dejagnu case here.

--
Pedro Alves