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]

Remote host fix for get_compiler_info


The testsuite function get_compiler_info runs the compiler with -E,
output to stdout, and captures the resulting output from the compiler
for processing to identify the compiler in use.

There is a long comment above the function about problems with -E and
-o in some cases.  In the case of remote-host testing, however, there
is a problem with not using -o: DejaGnu's remote-host support runs the
compiler with "-o a.out" then copies the output file, which does not
result in anything going in standard output, so the code relying on
standard output breaks.  So for remote-host testing to work it is
necessary to name an output file and read that file's contents, even
if this may not work for all compilers.  Hence this patch, which does
so in the remote host case.  OK to commit?

2009-04-17  Joseph Myers  <joseph@codesourcery.com>

	* lib/gdb.exp (get_compiler_info): Use -E -o in remote-host case.

Index: gdb/testsuite/lib/gdb.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v
retrieving revision 1.113
diff -u -r1.113 gdb.exp
--- gdb/testsuite/lib/gdb.exp	20 Mar 2009 23:04:40 -0000	1.113
+++ gdb/testsuite/lib/gdb.exp	17 Apr 2009 11:02:13 -0000
@@ -1539,7 +1539,17 @@
     # Run $ifile through the right preprocessor.
     # Toggle gdb.log to keep the compiler output out of the log.
     log_file
-    set cppout [ gdb_compile "${ifile}" "" preprocess [list "$args" quiet] ]
+    if [is_remote host] {
+	# We have to use -E and -o together, despite the comments
+	# above, because of how DejaGnu handles remote host testing.
+	set ppout "$outdir/compiler.i"
+	gdb_compile "${ifile}" "$ppout" preprocess [list "$args" quiet]
+	set file [open $ppout r]
+	set cppout [read $file]
+	close $file
+    } else {
+	set cppout [ gdb_compile "${ifile}" "" preprocess [list "$args" quiet] ]
+    }
     log_file -a "$outdir/$tool.log" 
 
     # Eval the output.

-- 
Joseph S. Myers
joseph@codesourcery.com


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