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: [RFC/gdb/testsuite] Another way to avoid the windows native tty troubles


 Hi Pedro,

  of course your patch is far better than mine and I second the integration
into CVS of it.

  Just one thing, did you think about the -nostdlibs issue?
>3) There is one compilation failure that seems to be specific to my
>patch and is related to a compilation using the -nodefaultlibs option    
>in gdb.base/prelink.so.
>  This probably means that cygwin is not linked in.
>Note that the compilation also fails without my patch, 
>but for some other reason (probably because some of 
>the linked object do require cygwin).

  Anyhow, I support this patch!

Pierre Muller
Pascal language support maintainer for GDB




-----Message d'origine-----
De?: gdb-patches-owner@sourceware.org
[mailto:gdb-patches-owner@sourceware.org] De la part de Pedro Alves
Envoyé?: Monday, June 16, 2008 5:23 AM
À?: gdb-patches@sourceware.org
Cc?: Pierre Muller
Objet?: Re: [RFC/gdb/testsuite] Another way to avoid the windows native tty
troubles

A Saturday 14 June 2008 01:15:45, Pierre Muller wrote:

>   Several answers concerned the reasons of the tty problems, but I was 
> mainly interested in getting more reliable testsuite results for 
> windows targets.
>   Lots of tests fail simply because the programs think that they are 
> not on a terminal and thus use full buffering, which is incompatible 
> with the testsuite logic.
>
> But, as Pedro said, individual files are not the right location to fix 
> this.
>
>   I finally came up with a different idea, that seems to work now 
> quite well.
>
>   The idea is simply to add an object that call setbuf(stdout,NULL) in 
> a function that is added to the ctor section.
>   The source
> gdb.arch/cygwin-ctor.c is simply:
> $ cat ../gdb.arch/cygwin-ctor.c
>
> #include <stdio.h>
>
> void
> disableoutbuffer ()
> {
>   setbuf (stdout, 0);
> }
>
> asm (".section .ctor");
> asm(" .long     _disableoutbuffer");
>
> <<< End of cygwin-ctor.c file >>>

Pierre, this is exactly how we have fixed this issue for our internal mingw
testing.  I apologize for not telling you about it before, and not sparring
you the trouble.

We have the attached patch installed in our tree for a few months now, and
never seen a problem with it -- and we use the same tree for linux testing
too.  It works OK in remote host testing too, and avoids as much as possible
interfering with test flags, and also avoids compiling the magic object more
than once per testsuite run.

> This file can be compile with gcc as cygwin-ctor.o or with gcc 
> -mno-cygwin as mingw-ctor.o (allowing to use it for mingw tests, even 
> if those still have lots of other problems).
>

>   The gdb_compile procedure change is rather simple, but it could 
> probably be made more universal by converting this into a target info 
> property that would be set in site.exp file for instance.

That's the reason I didn't submit this patch right away.  On the one hand,
this is a problem with the test environment, e.g., using ssh to test mingw.
I'm not sure if running tests under MSFT's telnetd/cmd.exe would still have
this problem or not.  OTOH, cygwin inferiors in a cygwin superior don't
recognize they are running under a tty, because GDB invokes them with
CreateProcess, so this is a GDB/Cygwin problem, not a test environment
problem.

All in all, my opinion is that this is hitting everyone that tests on
Windows, so deserves to go into common GDB testsuite code.

What do others think?

--
Pedro Alves



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