From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26755 invoked by alias); 6 Aug 2010 17:40:05 -0000 Received: (qmail 26734 invoked by uid 22791); 6 Aug 2010 17:40:03 -0000 X-SWARE-Spam-Status: No, hits=-6.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_BJ,TW_JC,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 06 Aug 2010 17:39:58 +0000 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o76HdrJ2007144 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 6 Aug 2010 13:39:53 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o76HdqkW003087; Fri, 6 Aug 2010 13:39:52 -0400 Received: from opsy.redhat.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o76Hdp03014512; Fri, 6 Aug 2010 13:39:52 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id AF2BB3782ED; Fri, 6 Aug 2010 11:39:51 -0600 (MDT) From: Tom Tromey To: Doug Evans Cc: gdb-patches@sourceware.org Subject: Re: [0/4] RFC: add DWARF index support References: Date: Fri, 06 Aug 2010 17:40:00 -0000 In-Reply-To: (Doug Evans's message of "Fri, 6 Aug 2010 10:15:18 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-08/txt/msg00082.txt.bz2 Doug> IWBN to add to the comment about exiting without creating an index not Doug> being an error, e.g. provide an example. Doug> Is it because the file could be stripped? [If it is stripped, should Doug> the script fail or pass? Dunno.] I don't want to do this, because the reasons may change. Doug> IWBN to put "${file}.gdb-index" in its own variable so that there's Doug> just one instance. Ok. Doug> LGTM with the above nits. I don't know what LGTM means. How about this? Tom 2010-08-05 Tom Tromey * gdb-add-index.sh: Add error checking. Index: gdb-add-index.sh =================================================================== RCS file: /cvs/src/src/gdb/gdb-add-index.sh,v retrieving revision 1.1 diff -u -r1.1 gdb-add-index.sh --- gdb-add-index.sh 30 Jul 2010 20:46:34 -0000 1.1 +++ gdb-add-index.sh 6 Aug 2010 17:39:20 -0000 @@ -16,14 +16,29 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +if test $# -ne 1; then + echo "Usage: gdb-add-index FILE" 1>&2 + exit 1 +fi + file="$1" dir="${file%/*}" +index="${file}.gdb-index" -gdb --batch-silent -ex "file $file" -ex "save gdb-index $dir" +gdb --batch-silent -ex "file $file" -ex "save gdb-index $dir" || { + status=$? + # Just in case. + rm -f "$index" + exit $status +} -if test -f "${file}.gdb-index"; then - objcopy --add-section .gdb_index="${file}.gdb-index" --set-section-flags .gdb_index=readonly "$file" "$file" - rm -f "${file}.gdb-index" +# In some situation gdb can exit without creating an index. This is +# not an error. +status=0 +if test -f "${index}"; then + objcopy --add-section .gdb_index="${index}" --set-section-flags .gdb_index=readonly "$file" "$file" + status=$? + rm -f "${index}" fi -exit 0 +exit $status