From patchwork Sun Jun 18 19:32:34 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kratochvil X-Patchwork-Id: 21065 Received: (qmail 28463 invoked by alias); 18 Jun 2017 19:32:35 -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 28136 invoked by uid 89); 18 Jun 2017 19:32:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=rc, dwp X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 18 Jun 2017 19:32:32 +0000 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 548224E4C8; Sun, 18 Jun 2017 19:32:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 548224E4C8 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jan.kratochvil@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 548224E4C8 Received: from host1.jankratochvil.net (ovpn-116-67.ams2.redhat.com [10.36.116.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id 90524812EF; Sun, 18 Jun 2017 19:32:35 +0000 (UTC) Subject: [PATCH v2 1/5] cc-with-tweaks.sh: Use gdb-add-index.sh From: Jan Kratochvil To: gdb-patches@sourceware.org Cc: Victor Leschuk Date: Sun, 18 Jun 2017 21:32:34 +0200 Message-ID: <149781435475.10382.12082103240715134039.stgit@host1.jankratochvil.net> In-Reply-To: <149781434459.10382.10368140746387313573.stgit@host1.jankratochvil.net> References: <149781434459.10382.10368140746387313573.stgit@host1.jankratochvil.net> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Hi, currently contrib/cc-with-tweaks.sh is calling for its -i option objcopy itself instead of using contrib/gdb-add-index.sh which does the same. With DWARF-5 .debug_names the commands are more complicated (as now also .debug_str needs to be modified) and so I have decided to rather reuse contrib/gdb-add-index.sh instead of duplicating its code in contrib/cc-with-tweaks.sh. The problem is when no index is produced whether contrib/cc-with-tweaks.sh should fail or not. As originally contrib/cc-with-tweaks.sh was more quiet (=successful) than contrib/gdb-add-index.sh and so after this patch the testsuite runs with an index would "regress". I have tried to keep the behavior unchanged. Some cases still error with: Ada is not currently supported by the index But some cases (such as some trivial gdb.dwarf2/ testcases with no DWARF data to index) produce no index while the testcases still PASS now instead of: -PASS: gdb.arch/i386-bp_permanent.exp: stack pointer value matches +gdb compile failed, gdb-add-index.sh: No index was created for /quadgdb/testsuite.unix.-m64/outputs/gdb.arch/i386-bp_permanent/i386-bp_permanent +gdb-add-index.sh: [Was there no debuginfo? Was there already an index?] +UNTESTED: gdb.arch/i386-bp_permanent.exp: failed to compile Jan gdb/ChangeLog 2017-05-26 Jan Kratochvil * contrib/cc-with-tweaks.sh (t, GDB_ADD_INDEX): New variables. <$want_index>: Call $GDB_ADD_INDEX. --- gdb/contrib/cc-with-tweaks.sh | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/gdb/contrib/cc-with-tweaks.sh b/gdb/contrib/cc-with-tweaks.sh index 7d39c00..c5a8088 100755 --- a/gdb/contrib/cc-with-tweaks.sh +++ b/gdb/contrib/cc-with-tweaks.sh @@ -74,6 +74,8 @@ DWP=${DWP:-dwp} have_link=unknown next_is_output_file=no output_file=a.out +t=/tmp/cc-with-tweaks.$$ +rm -f $t want_index=false want_dwz=false @@ -93,6 +95,25 @@ while [ $# -gt 0 ]; do shift done +if [ "$want_index" = true ]; then + if [ -z "$GDB_ADD_INDEX" ] + then + if [ -f ./contrib/gdb-add-index.sh ] + then + GDB_ADD_INDEX="./contrib/gdb-add-index.sh" + elif [ -f ../contrib/gdb-add-index.sh ] + then + GDB_ADD_INDEX="../contrib/gdb-add-index.sh" + elif [ -f ../../contrib/gdb-add-index.sh ] + then + GDB_ADD_INDEX="../../contrib/gdb-add-index.sh" + else + echo "$myname: unable to find usable contrib/gdb-add-index.sh" >&2 + exit 1 + fi + fi +fi + for arg in "$@" do if [ "$next_is_output_file" = "yes" ] @@ -152,20 +173,11 @@ if [ "$want_objcopy_compress" = true ]; then fi if [ "$want_index" = true ]; then - $GDB --batch-silent -nx -ex "set auto-load no" -ex "file $output_file" -ex "save gdb-index $output_dir" - rc=$? - [ $rc != 0 ] && exit $rc - - # GDB might not always create an index. Cope. - if [ -f "$index_file" ] - then - $OBJCOPY --add-section .gdb_index="$index_file" \ - --set-section-flags .gdb_index=readonly \ - "$output_file" "$output_file" - rc=$? - else - rc=0 - fi + # Filter out these messages which would stop dejagnu testcase run: + # echo "$myname: No index was created for $file" 1>&2 + # echo "$myname: [Was there no debuginfo? Was there already an index?]" 1>&2 + GDB=$GDB $GDB_ADD_INDEX "$output_file" 2>&1|grep -v "^${GDB_ADD_INDEX##*/}: " >&2 + rc=${PIPESTATUS[0]} [ $rc != 0 ] && exit $rc fi