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]

[RFC] testsuite default extension for executable problem


  I recently ran accross a cygwin failure in gdb.server/file-transfer.exp

  This problem is due to the fact that the compiled binary has a hidden
'.exe'
suffix that the 'remote put ' command does not handle.

  To solve this issue, I thought that a simple one line patch
would be it.

ChangeLog entry:

2008-07-11  Pierre Muller  <muller@ics.u-strasbg.fr>

	* (gdb.server/file-transfer.exp): Add EXEEXT
	to fix Cygwin failures.


Index: gdb.server/file-transfer.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.server/file-transfer.exp,v
retrieving revision 1.2
diff -u -p -r1.2 file-transfer.exp
--- gdb.server/file-transfer.exp        1 Jan 2008 22:53:21 -0000       1.2
+++ gdb.server/file-transfer.exp        11 Jul 2008 12:46:22 -0000
@@ -20,7 +20,7 @@ load_lib gdbserver-support.exp

 set testfile "server"
 set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+set binfile ${objdir}/${subdir}/${testfile}${EXEEXT}

 if { [skip_gdbserver_tests] } {
     return 0



  But I suddenly realized that there was a problem with this patch:
it would not work correctly for a cross-gdb.

  Say that you compile gdb on cygwin, for a sh-*-linux target,
then you would run the testsuite remotely on a sh-*-linux machine.

  We compiling the server.c file, the testsuite would use target_compile,
and a gcc with sh-*-linux target would be used for that.
  Forcing the compiled executable to have a '.exe' suffix would probably not
lead to any specific failure, but it still seems wrong to me to
use this extension in that case.

  In fact, I suspect that we should consider two EXEEXT variables,
one for the host and a second for the target.
  In the current HEAD, EXEEXT is relevant for the host architecture,
not for the target architecture.

  Thus I would like to propose to add HOSTEXEEXT and TARGETEXEEXT
to lib/gdb.exp

  I send a patch below, but it would need to be complemented by 
a change of all uses of EXEEXT variable in the testsuite
into either HOSTEXTEXT or TARGETEXEEXT.

  For all the cases where EXEEXT is just added as a suffix to 
binfile, it would be clear that TARGETEXEEXT needs to be used.

Listing:
$ grep -w EXEEXT  */*.exp
gdb.ada/exec_changed.exp:# Build the first test program (note that cygwin
needs the $EXEEXT).
gdb.ada/exec_changed.exp:set binfile1
${objdir}/${subdir}/${testfile1}$EXEEXT
gdb.ada/exec_changed.exp:set binfile2
${objdir}/${subdir}/${testfile2}$EXEEXT
gdb.ada/exec_changed.exp:set binfile ${objdir}/${subdir}/${testfile}$EXEEXT
gdb.base/annota3.exp:set binfile ${objdir}/${subdir}/${testfile}$EXEEXT
gdb.base/maint.exp:     -re ".*Object file.*break($EXEEXT)?:  Objfile at
$hex, bfd at $hex, \[0-9\]* minsyms\[\r\t \]+\n" { set header 1 }
gdb.base/maint.exp:        -re "Exec file:\r\n.*break($EXEEXT)?., file
type.*$gdb_prompt $"\
gdb.base/reread.exp:# Cygwin needs $EXEEXT.
gdb.base/reread.exp:set binfile1 ${objdir}/${subdir}/${testfile1}$EXEEXT
gdb.base/reread.exp:set binfile2 ${objdir}/${subdir}/${testfile2}$EXEEXT
gdb.base/reread.exp:set binfile ${objdir}/${subdir}/${testfile}$EXEEXT
gdb.base/sepdebug.exp:set binfile ${objdir}/${subdir}/${testfile}${EXEEXT}
gdb.base/sepsymtab.exp:set binfile ${objdir}/${subdir}/${testfile}${EXEEXT}
gdb.pascal/floats.exp:set binfile ${objdir}/${subdir}/${testfile}$EXEEXT
gdb.pascal/hello.exp:set binfile ${objdir}/${subdir}/${testfile}${EXEEXT}
gdb.pascal/integers.exp:set binfile ${objdir}/${subdir}/${testfile}$EXEEXT
gdb.server/file-transfer.exp:set binfile
${objdir}/${subdir}/${testfile}${EXEEXT}
lib/gdb.exp:if [info exists env(EXEEXT)] {
lib/gdb.exp:    set HOSTEXEEXT $env(EXEEXT)

  The last three occurrences are on locally modified files...
It seems to me that all those would be candidates for EXEEXT to
TARGETEXEEXT.


  The testsuite directory configure file has a EXEEXT test,
but I wonder if it does the right thing...

  I tried to compile gdb for i386-pc-linux target
and the testsuite level configure uses the cached variable from
up directory... thus getting EXEEXT=.exe.
  Disabling the cache by rerunning the configure in gdb/testsuite 
directory directly still gave the same result, because host 'gcc'
was used for testing.

  Is this a bug or is it just correct that EXEEXT should be the
host one, and not the target one. This test validates the idea that
the EXEEXT env value should be used for HOSTEXEEXT.
  Should configure try to determine TARGETEXEEXT?
I am still unable to really understand how configure works,
so don't count on me to provide a patch for this :(

  
  If people agree that this change is desirable, I would
submit a patch that changes all EXEEXT in exp files into
TARGETEXEEXT together with what is below.

  But I am first interested in comments,

Pierre Muller
Pascal language support maintainer for GDB




gdb/testsuite ChangeLog entry:

2008-07-11  Pierre Muller  <muller@ics.u-strasbg.fr>

	* (lib/gdb.exp): Replace EXEEXT by HOSTEXEEXT and TARGETEXEEXT.


Index: lib/gdb.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v
retrieving revision 1.104
diff -u -p -r1.104 gdb.exp
--- lib/gdb.exp 27 Jun 2008 16:42:19 -0000      1.104
+++ lib/gdb.exp 11 Jul 2008 12:46:22 -0000
@@ -76,15 +76,32 @@ set fullname_syntax_DOS {[a-zA-Z]:.*\\}
 set fullname_syntax
"($fullname_syntax_POSIX|$fullname_syntax_UNC|$fullname_syntax_DOS_CASE|$ful
lname_syntax_DOS)"

 # Needed for some tests under Cygwin.
-global EXEEXT
+global HOSTEXEEXT
+global TARGETEXEEXT
 global env

-if ![info exists env(EXEEXT)] {
-    set EXEEXT ""
+if [info exists env(EXEEXT)] {
+    set HOSTEXEEXT $env(EXEEXT)
+} elseif {([ishost *-*-cygwin*]
+           || [ishost *-*-mingw*]
+           || [ishost *-*-*djgpp*]
+           || [ishost *-*-go32*])} {
+    set HOSTEXEEXT ".exe"
 } else {
-    set EXEEXT $env(EXEEXT)
+    set HOSTEXEEXT ""
 }

+if [info exists env(TARGETEXEEXT)] {
+    set TARGETEXEEXT $env(TARGETEXEEXT)
+} elseif {([istarget *-*-cygw*]
+        || [istarget *-*-mingw*]
+        || [istarget *-*-go32*]
+        || [istarget *-*-*djgpp*])} {
+    set TARGETEXEEXT ".exe"
+} else {
+set TARGETEXEEXT ""
+}
+





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