From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3999 invoked by alias); 6 Aug 2010 17:15:31 -0000 Received: (qmail 3985 invoked by uid 22791); 6 Aug 2010 17:15:30 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_PASS,TW_BJ,TW_JC,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (74.125.121.35) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 06 Aug 2010 17:15:23 +0000 Received: from hpaq14.eem.corp.google.com (hpaq14.eem.corp.google.com [172.25.149.14]) by smtp-out.google.com with ESMTP id o76HFKqY002739 for ; Fri, 6 Aug 2010 10:15:20 -0700 Received: from vws19 (vws19.prod.google.com [10.241.21.147]) by hpaq14.eem.corp.google.com with ESMTP id o76HFJLX010115 for ; Fri, 6 Aug 2010 10:15:19 -0700 Received: by vws19 with SMTP id 19so6011088vws.32 for ; Fri, 06 Aug 2010 10:15:19 -0700 (PDT) MIME-Version: 1.0 Received: by 10.220.161.200 with SMTP id s8mr8532415vcx.216.1281114918871; Fri, 06 Aug 2010 10:15:18 -0700 (PDT) Received: by 10.220.201.197 with HTTP; Fri, 6 Aug 2010 10:15:18 -0700 (PDT) In-Reply-To: References: Date: Fri, 06 Aug 2010 17:15:00 -0000 Message-ID: Subject: Re: [0/4] RFC: add DWARF index support From: Doug Evans To: Tom Tromey Cc: gdb-patches@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-System-Of-Record: true X-IsSubscribed: yes 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/msg00078.txt.bz2 On Thu, Aug 5, 2010 at 12:56 PM, Tom Tromey wrote: > Doug> What happens if the script is invoked with none or too many argumen= ts? > > Oops, forgot this one. > > New patch. > > Tom > > 2010-08-05 =A0Tom Tromey =A0 > > =A0 =A0 =A0 =A0* gdb-add-index.sh: Add error checking. > > Index: gdb-add-index.sh > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > 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 =A0 =A030 Jul 2010 20:46:34 -0000 =A0 =A0 =A01.1 > +++ gdb-add-index.sh =A0 =A05 Aug 2010 19:56:24 -0000 > @@ -16,14 +16,27 @@ > =A0# You should have received a copy of the GNU General Public License > =A0# along with this program. =A0If not, see . > > +if test $# -ne 1; then > + =A0 echo "Usage: gdb-add-index FILE" 1>&2 > + =A0 exit 1 > +fi > + > =A0file=3D"$1" > =A0dir=3D"${file%/*}" > > -gdb --batch-silent -ex "file $file" -ex "save gdb-index $dir" > +gdb --batch-silent -ex "file $file" -ex "save gdb-index $dir" || { > + =A0 # Just in case. status=3D$? > + =A0 rm -f "${file}.gdb-index" > + =A0 exit 1 exit $status > +} > > +# In some situation gdb can exit without creating an index. =A0This is > +# not an error. > +status=3D0 > =A0if test -f "${file}.gdb-index"; then > =A0 =A0objcopy --add-section .gdb_index=3D"${file}.gdb-index" --set-secti= on-flags .gdb_index=3Dreadonly "$file" "$file" > + =A0 status=3D$? > =A0 =A0rm -f "${file}.gdb-index" > =A0fi > > -exit 0 > +exit $status > IWBN to add to the comment about exiting without creating an index not being an error, e.g. provide an example. Is it because the file could be stripped? [If it is stripped, should the script fail or pass? Dunno.] IWBN to put "${file}.gdb-index" in its own variable so that there's just one instance. LGTM with the above nits.