public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] [gdb/testsuite] Fix "unable to find usable gdb" error with cc-with-tweaks.exp
@ 2019-05-01 13:31 Tom de Vries
0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2019-05-01 13:31 UTC (permalink / raw)
To: gdb-cvs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f59f30f55776b10d4f728065e9f9a10cf63a1b29
commit f59f30f55776b10d4f728065e9f9a10cf63a1b29
Author: Tom de Vries <tdevries@suse.de>
Date: Wed May 1 15:31:14 2019 +0200
[gdb/testsuite] Fix "unable to find usable gdb" error with cc-with-tweaks.exp
When running fullpath-expand.exp with target_board=dwarf4-gdb-index, we run
into:
...
$ make check-gdb RUNTESTFLAGS="--target_board=dwarf4-gdb-index fullpath-expand.exp"
Running src/gdb/testsuite/gdb.base/fullpath-expand.exp ...
gdb compile failed, cc-with-tweaks.sh: unable to find usable gdb
=== gdb Summary ===
nr of untested testcases 1
...
The same happens with fullname.exp.
The dwarf4-gdb-index.exp board file includes cc-with-tweaks.exp, which uses
cc-with-tweaks.sh, which calls gdb-add-index.sh.
The gdb-add-index.sh script uses a gdb executable, defaulting to gdb:
...
GDB=${GDB:=gdb}
...
The cc-with-tweaks.sh script tries to ensure that the build gdb executable is
used by gdb-add-index.sh:
...
if [ -z "$GDB" ]
then
if [ -f ./gdb ]
then
GDB="./gdb -data-directory data-directory"
elif [ -f ../gdb ]
then
GDB="../gdb -data-directory ../data-directory"
elif [ -f ../../gdb ]
then
GDB="../../gdb -data-directory ../../data-directory"
else
echo "$myname: unable to find usable gdb" >&2
exit 1
fi
fi
...
So, if the current directory is build/gdb/testsuite, then a gdb executable
build/gdb/testsuite/../gdb will be used.
However, in the case of fullpath-expand.exp the test cd's into the sources:
...
set saved_pwd [pwd]
cd $srcdir
set err [gdb_compile "${subdir}/${srcfile} ${subdir}/${srcfile2}" $binfile \
executable {debug}]
cd $saved_pwd
...
and cc-with-tweaks.sh generates the "unable to find usable gdb" error.
The same error occurs if we use --target_board=cc-with-dwz instead (only in
this case we actually don't need gdb, we just need the GDB variable to be set
in cc-with-tweaks.sh, which arguably is a bug in cc-with-tweaks.sh).
Fix both errors in cc-with-tweaks.exp by generating a gdb script gdb.sh using
$GDB, $GDBFLAGS and $INTERNAL_GDBFLAGS and passing this script to
cc-with-tweaks.sh by setting env(GDB).
Tested on x86_64-linux for gdb.base.
gdb/testsuite/ChangeLog:
2019-05-01 Tom de Vries <tdevries@suse.de>
* boards/cc-with-tweaks.exp: Generate gdb.sh, and pass it in env(GDB).
Diff:
---
gdb/testsuite/ChangeLog | 4 ++++
gdb/testsuite/boards/cc-with-tweaks.exp | 5 +++++
2 files changed, 9 insertions(+)
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index e1c2bfa..6331e52 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,9 @@
2019-05-01 Tom de Vries <tdevries@suse.de>
+ * boards/cc-with-tweaks.exp: Generate gdb.sh, and pass it in env(GDB).
+
+2019-05-01 Tom de Vries <tdevries@suse.de>
+
* boards/dwarf4-gdb-index.exp: Use cc-with-tweaks.exp.
2019-04-30 Ali Tamur <tamur@google.com>
diff --git a/gdb/testsuite/boards/cc-with-tweaks.exp b/gdb/testsuite/boards/cc-with-tweaks.exp
index 11ec6a2..c50a006 100644
--- a/gdb/testsuite/boards/cc-with-tweaks.exp
+++ b/gdb/testsuite/boards/cc-with-tweaks.exp
@@ -53,3 +53,8 @@ if ![info exists CXX_FOR_TARGET] {
set CXX_FOR_TARGET "$found_gxx"
}
set CXX_FOR_TARGET "$contrib_dir/cc-with-tweaks.sh $CC_WITH_TWEAKS_FLAGS $CXX_FOR_TARGET"
+
+set pwd [exec pwd -P]
+exec echo $GDB $INTERNAL_GDBFLAGS $GDBFLAGS \"\$@\" > $pwd/gdb.sh
+exec chmod +x gdb.sh
+set env(GDB) $pwd/gdb.sh
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-05-01 13:31 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-01 13:31 [binutils-gdb] [gdb/testsuite] Fix "unable to find usable gdb" error with cc-with-tweaks.exp Tom de Vries
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).