From patchwork Wed May 1 13:33:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 32473 Received: (qmail 28383 invoked by alias); 1 May 2019 13:33:11 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 28375 invoked by uid 89); 1 May 2019 13:33:11 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mx1.suse.de Received: from mx2.suse.de (HELO mx1.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 01 May 2019 13:33:10 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 2FC64AD04 for ; Wed, 1 May 2019 13:33:08 +0000 (UTC) Date: Wed, 1 May 2019 15:33:06 +0200 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [committed][gdb/testsuite] Fix "unable to find usable gdb" error with cc-with-tweaks.exp Message-ID: <20190501133305.GA12246@delia> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-IsSubscribed: yes Hi, 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. Committed to trunk. Thanks, - Tom [gdb/testsuite] Fix "unable to find usable gdb" error with cc-with-tweaks.exp gdb/testsuite/ChangeLog: 2019-05-01 Tom de Vries * boards/cc-with-tweaks.exp: Generate gdb.sh, and pass it in env(GDB). --- gdb/testsuite/boards/cc-with-tweaks.exp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gdb/testsuite/boards/cc-with-tweaks.exp b/gdb/testsuite/boards/cc-with-tweaks.exp index 11ec6a2850..c50a0065c2 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