* [RFA] testsuite: avoid compilation error on cygwin/mingw if -nostdlib option is used.
@ 2009-10-01 22:36 Pierre Muller
2009-10-01 23:29 ` Pedro Alves
0 siblings, 1 reply; 5+ messages in thread
From: Pierre Muller @ 2009-10-01 22:36 UTC (permalink / raw)
To: gdb-patches
To get useful output of the testsuite
for cygwin/mingw/djgpp, we need to force
the compiled programs in the testsuite to
act as it they were on a terminal,
which usually results into disabling buffering
for stdout and stderr.
This does not work for cygwin,
and thus we added set_unbuffered_mode.c
code.
This works almost always, unless -nostdlib
option is given at link time, as in that case
setvbuf function call will not be resolved.
The patch below disables adding the set_unbuffered_mode
object if -nostdlib option is given.
Pierre Muller
Pascal language support maintainer for GDB
2009-10-02 Pierre Muller <muller@ics.u-strasbg.fr>
* lib/gdb.exp (gdb_compile): Avoid adding
gdb_saved_unbuffered_mode_obj if -nostdlib option is used.
Index: lib/gdb.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v
retrieving revision 1.119
diff -u -p -r1.119 gdb.exp
--- lib/gdb.exp 13 Jul 2009 19:24:18 -0000 1.119
+++ lib/gdb.exp 1 Oct 2009 21:56:14 -0000
@@ -1802,6 +1854,11 @@ proc gdb_compile {source dest type optio
# which is time consuming, especially if we're remote
# host testing.
#
+ set add_unbuffered_object 1;
+ if {[lsearch -regexp $options ".*-nostdlib.*"] >= 0 } {
+ verbose "No set_unbuffered_mode for -nostdlib option";
+ set add_unbuffered_object 0;
+ }
if { $gdb_saved_set_unbuffered_mode_obj == "" } {
verbose "compiling gdb_saved_set_unbuffered_obj"
set unbuf_src ${srcdir}/lib/set_unbuffered_mode.c
@@ -1824,7 +1881,9 @@ proc gdb_compile {source dest type optio
# reverse link order. In that case, we can use ldflags to
# avoid copying the object file to the host multiple
# times.
- lappend options "ldflags=$gdb_saved_set_unbuffered_mode_obj"
+ if { $add_unbuffered_object == 1 } {
+ lappend options "ldflags=$gdb_saved_set_unbuffered_mode_obj"
+ }
}
}
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFA] testsuite: avoid compilation error on cygwin/mingw if -nostdlib option is used.
2009-10-01 22:36 [RFA] testsuite: avoid compilation error on cygwin/mingw if -nostdlib option is used Pierre Muller
@ 2009-10-01 23:29 ` Pedro Alves
2009-10-02 7:15 ` [RFA-v2] " Pierre Muller
0 siblings, 1 reply; 5+ messages in thread
From: Pedro Alves @ 2009-10-01 23:29 UTC (permalink / raw)
To: gdb-patches; +Cc: Pierre Muller
Seems reasonable. This is okay, with nits below.
On Thursday 01 October 2009 23:36:12, Pierre Muller wrote:
> + set add_unbuffered_object 1;
> + if {[lsearch -regexp $options ".*-nostdlib.*"] >= 0 } {
> + verbose "No set_unbuffered_mode for -nostdlib option";
> + set add_unbuffered_object 0;
> + }
The ';' are unnecessary. The '.*' are also unnecessary.
> if { $gdb_saved_set_unbuffered_mode_obj == "" } {
> verbose "compiling gdb_saved_set_unbuffered_obj"
> set unbuf_src ${srcdir}/lib/set_unbuffered_mode.c
> @@ -1824,7 +1881,9 @@ proc gdb_compile {source dest type optio
> # reverse link order. In that case, we can use ldflags to
> # avoid copying the object file to the host multiple
> # times.
> - lappend options "ldflags=$gdb_saved_set_unbuffered_mode_obj"
> + if { $add_unbuffered_object == 1 } {
Works too:
if { $add_unbuffered_object } {
Or, why not drop the extra variable, and just:
if {[lsearch -regexp $options "-nostdlib"] < 0 } {
lappend options "ldflags=$gdb_saved_set_unbuffered_mode_obj"
}
a suitable small comment would be nice too.
> + lappend options "ldflags=$gdb_saved_set_unbuffered_mode_obj"
> + }
> }
> }
--
Pedro Alves
^ permalink raw reply [flat|nested] 5+ messages in thread
* [RFA-v2] testsuite: avoid compilation error on cygwin/mingw if -nostdlib option is used.
2009-10-01 23:29 ` Pedro Alves
@ 2009-10-02 7:15 ` Pierre Muller
2009-10-02 16:58 ` Pedro Alves
0 siblings, 1 reply; 5+ messages in thread
From: Pierre Muller @ 2009-10-02 7:15 UTC (permalink / raw)
To: 'Pedro Alves', gdb-patches
Thanks Pedro for the feedback.
Here is an updated version
Is this OK?
Pierre
2009-10-02 Pierre Muller <muller@ics.u-strasbg.fr>
Pedro Alves <pedro@codesourcery.com>
* lib/gdb.exp (gdb_compile): Avoid adding
gdb_saved_unbuffered_mode_obj if -nostdlib option is used.
Index: lib/gdb.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v
retrieving revision 1.119
diff -u -p -r1.119 gdb.exp
--- lib/gdb.exp 13 Jul 2009 19:24:18 -0000 1.119
+++ lib/gdb.exp 2 Oct 2009 07:08:40 -0000
@@ -1824,7 +1824,11 @@ proc gdb_compile {source dest type optio
# reverse link order. In that case, we can use ldflags to
# avoid copying the object file to the host multiple
# times.
- lappend options "ldflags=$gdb_saved_set_unbuffered_mode_obj"
+ # This object can only be added if standard libraries are
+ # used. Thus, we need to disable it if -nostdlib option is used
+ if {[lsearch -regexp $options "-nostdlib"] < 0 } {
+ lappend options "ldflags=$gdb_saved_set_unbuffered_mode_obj"
+ }
}
}
> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Pedro Alves
> Envoyé : Friday, October 02, 2009 1:30 AM
> À : gdb-patches@sourceware.org
> Cc : Pierre Muller
> Objet : Re: [RFA] testsuite: avoid compilation error on cygwin/mingw if
> -nostdlib option is used.
>
> Seems reasonable. This is okay, with nits below.
>
> On Thursday 01 October 2009 23:36:12, Pierre Muller wrote:
>
> > + set add_unbuffered_object 1;
> > + if {[lsearch -regexp $options ".*-nostdlib.*"] >= 0 } {
> > + verbose "No set_unbuffered_mode for -nostdlib option";
> > + set add_unbuffered_object 0;
> > + }
>
> The ';' are unnecessary. The '.*' are also unnecessary.
>
> > if { $gdb_saved_set_unbuffered_mode_obj == "" } {
> > verbose "compiling gdb_saved_set_unbuffered_obj"
> > set unbuf_src ${srcdir}/lib/set_unbuffered_mode.c
> > @@ -1824,7 +1881,9 @@ proc gdb_compile {source dest type optio
> > # reverse link order. In that case, we can use ldflags to
> > # avoid copying the object file to the host multiple
> > # times.
> > - lappend options "ldflags=$gdb_saved_set_unbuffered_mode_obj"
> > + if { $add_unbuffered_object == 1 } {
>
> Works too:
>
> if { $add_unbuffered_object } {
>
> Or, why not drop the extra variable, and just:
>
> if {[lsearch -regexp $options "-nostdlib"] < 0 } {
> lappend options "ldflags=$gdb_saved_set_unbuffered_mode_obj"
> }
>
> a suitable small comment would be nice too.
>
> > + lappend options
> "ldflags=$gdb_saved_set_unbuffered_mode_obj"
> > + }
> > }
> > }
>
> --
> Pedro Alves
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFA-v2] testsuite: avoid compilation error on cygwin/mingw if -nostdlib option is used.
2009-10-02 7:15 ` [RFA-v2] " Pierre Muller
@ 2009-10-02 16:58 ` Pedro Alves
2009-10-02 21:30 ` Pierre Muller
0 siblings, 1 reply; 5+ messages in thread
From: Pedro Alves @ 2009-10-02 16:58 UTC (permalink / raw)
To: Pierre Muller; +Cc: gdb-patches
Ok.
--
Pedro Alves
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [RFA-v2] testsuite: avoid compilation error on cygwin/mingw if -nostdlib option is used.
2009-10-02 16:58 ` Pedro Alves
@ 2009-10-02 21:30 ` Pierre Muller
0 siblings, 0 replies; 5+ messages in thread
From: Pierre Muller @ 2009-10-02 21:30 UTC (permalink / raw)
To: 'Pedro Alves'; +Cc: gdb-patches
Thanks for the approval,
patch committed.
Pierre
> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Pedro Alves
> Envoyé : Friday, October 02, 2009 6:59 PM
> À : Pierre Muller
> Cc : gdb-patches@sourceware.org
> Objet : Re: [RFA-v2] testsuite: avoid compilation error on cygwin/mingw
> if -nostdlib option is used.
>
> Ok.
>
> --
> Pedro Alves
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-10-02 21:30 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-01 22:36 [RFA] testsuite: avoid compilation error on cygwin/mingw if -nostdlib option is used Pierre Muller
2009-10-01 23:29 ` Pedro Alves
2009-10-02 7:15 ` [RFA-v2] " Pierre Muller
2009-10-02 16:58 ` Pedro Alves
2009-10-02 21:30 ` Pierre Muller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox