This is the mail archive of the 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]

[RFA] testsuite: avoid compilation error on cygwin/mingw if -nostdlib option is used.

  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

  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  <>

	* 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"
+	    }

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