diff options
Diffstat (limited to 'gdb')
| -rw-r--r-- | gdb/testsuite/gdb.gdb/index-file.exp | 7 | ||||
| -rw-r--r-- | gdb/testsuite/lib/selftest-support.exp | 46 |
2 files changed, 44 insertions, 9 deletions
diff --git a/gdb/testsuite/gdb.gdb/index-file.exp b/gdb/testsuite/gdb.gdb/index-file.exp index 2252b79..a9af211 100644 --- a/gdb/testsuite/gdb.gdb/index-file.exp +++ b/gdb/testsuite/gdb.gdb/index-file.exp @@ -30,6 +30,13 @@ if { $filename eq "" } { return -1 } +# If FILENAME is a libtool wrapper, then we need to get the path of the real +# executable. +set filename [selftest_libtool_get_real_gdb_executable $filename] +if { $filename eq "" } { + return -1 +} + with_timeout_factor $timeout_factor { # Start GDB, load FILENAME. clean_restart $filename diff --git a/gdb/testsuite/lib/selftest-support.exp b/gdb/testsuite/lib/selftest-support.exp index 0ab10f2..af8ec6f 100644 --- a/gdb/testsuite/lib/selftest-support.exp +++ b/gdb/testsuite/lib/selftest-support.exp @@ -52,6 +52,37 @@ proc _selftest_has_libtool {} { return [expr {$status == 0}] } +# If GDB is executed from a build tree, run libtool to obtain the real +# executable path for EXECUTABLE, which may be a libtool wrapper. Return +# the path on success. On failure, issue an UNTESTED test result and return +# an empty string. +# +# If GDB is executed from an installed location, return EXECUTABLE unchanged. +# +# If libtool is not present on the host system, return EXECUTABLE unchanged. +# The test might still work, because the GDB binary is not always a libtool +# wrapper. + +proc selftest_libtool_get_real_gdb_executable { executable } { + if [_selftest_gdb_is_installed] { + return $executable + } + + if ![_selftest_has_libtool] { + return $executable + } + + lassign [remote_exec host libtool "--mode=execute echo -n $executable"] \ + status executable + + if { $status != 0 } { + untested "failed to run libtool" + return "" + } + + return $executable +} + # Return true if EXECUTABLE has debug info. # # If it doesn't, or if it's not possible to determine, issue an UNTESTED test @@ -73,15 +104,12 @@ proc _selftest_check_executable_debug_info { executable } { # # If testing against an installed GDB, then there won't be a libtool # wrapper, no need to convert. - if { ![_selftest_gdb_is_installed] && [_selftest_has_libtool] } { - lassign [remote_exec host libtool \ - "--mode=execute echo -n $executable"] \ - status executable - - if { $status != 0 } { - untested "failed to run libtool" - return false - } + set executable [selftest_libtool_get_real_gdb_executable $executable] + + if { $executable == "" } { + # selftest_libtool_get_real_gdb_executable already records an UNTESTED + # on failure. + return false } gdb_start |
