Fix Windows-target testing in gdb_file_cmd
authorJoseph Myers <joseph@codesourcery.com>
Fri, 13 Nov 2020 16:35:02 +0000 (16:35 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Fri, 13 Nov 2020 16:35:02 +0000 (16:35 +0000)
GCC for Windows target produces executables called foo.exe when given
"-o foo".  (More specifically, it's done that for native compilers for
a long time, and for cross compilers to Windows target since GCC
commit 5bc86b599054f494ec0a45e49b82749320eaa9c4, in GCC 8 and later.)
This causes problems for many GDB tests expecting a program to have
the exact file name passed to -o.

Fix this by checking for the case where only the .exe exists in
gdb_file_cmd and adjusting the name passed to the file command
accordingly.  There may well be other places with this issue in the
GDB testsuite, but this fix allows many tests to succeed that
previously fell over.

2020-11-12  Joseph Myers  <joseph@codesourcery.com>

* lib/gdb.exp (gdb_file_cmd): Check for case where $arg.exe exists
but $arg does not.

gdb/testsuite/ChangeLog
gdb/testsuite/lib/gdb.exp

index 8cff6467603d3a7813c84b29d0790b98928d709c..b1ca924c2f0d132b9b0743818ff7899f5eb0ce02 100644 (file)
@@ -1,3 +1,8 @@
+2020-11-12  Joseph Myers  <joseph@codesourcery.com>
+
+       * lib/gdb.exp (gdb_file_cmd): Check for case where $arg.exe exists
+       but $arg does not.
+
 2020-11-12  Andrew Burgess  <andrew.burgess@embecosm.com>
 
        * gdb.fortran/types.exp: Add more tests.
index 55154db6a50e843b4ec7d314117fc478de43563e..c42933b3f41ec540762393bfb0d30c5c4d160366 100644 (file)
@@ -1846,6 +1846,11 @@ proc gdb_file_cmd { arg } {
     global GDB
     global last_loaded_file
 
+    # GCC for Windows target may create foo.exe given "-o foo".
+    if { ![file exists $arg] && [file exists "$arg.exe"] } {
+       set arg "$arg.exe"
+    }
+
     # Save this for the benefit of gdbserver-support.exp.
     set last_loaded_file $arg
 
This page took 0.034893 seconds and 4 git commands to generate.