From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2212 invoked by alias); 2 Aug 2010 18:10:15 -0000 Received: (qmail 2196 invoked by uid 22791); 2 Aug 2010 18:10:13 -0000 X-SWARE-Spam-Status: No, hits=-1.9 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; Mon, 02 Aug 2010 18:10:06 +0000 Received: from wpaz1.hot.corp.google.com (wpaz1.hot.corp.google.com [172.24.198.65]) by smtp-out.google.com with ESMTP id o72IA3d4003805 for ; Mon, 2 Aug 2010 11:10:04 -0700 Received: from pwi6 (pwi6.prod.google.com [10.241.219.6]) by wpaz1.hot.corp.google.com with ESMTP id o72IA1UX002780 for ; Mon, 2 Aug 2010 11:10:01 -0700 Received: by pwi6 with SMTP id 6so2172352pwi.10 for ; Mon, 02 Aug 2010 11:10:01 -0700 (PDT) MIME-Version: 1.0 Received: by 10.115.109.6 with SMTP id l6mr7693082wam.164.1280772600593; Mon, 02 Aug 2010 11:10:00 -0700 (PDT) Received: by 10.220.186.74 with HTTP; Mon, 2 Aug 2010 11:10:00 -0700 (PDT) In-Reply-To: References: Date: Mon, 02 Aug 2010 18:10: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/msg00002.txt.bz2 On Fri, Jul 30, 2010 at 1:46 PM, Tom Tromey wrote: > [...] > 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: gdb-add-index.sh > diff -N gdb-add-index.sh > --- /dev/null =A0 1 Jan 1970 00:00:00 -0000 > +++ gdb-add-index.sh =A0 =A030 Jul 2010 20:45:30 -0000 > @@ -0,0 +1,29 @@ > +#! /bin/sh > + > +# Add a .gdb_index section to a file. > + > +# Copyright (C) 2010 Free Software Foundation, Inc. > +# This program is free software; you can redistribute it and/or modify > +# it under the terms of the GNU General Public License as published by > +# the Free Software Foundation; either version 3 of the License, or > +# (at your option) any later version. > +# > +# This program is distributed in the hope that it will be useful, > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. =A0See the > +# GNU General Public License for more details. > +# > +# You should have received a copy of the GNU General Public License > +# along with this program. =A0If not, see . > + > +file=3D"$1" > +dir=3D"${file%/*}" > + > +gdb --batch-silent -ex "file $file" -ex "save gdb-index $dir" > + > +if test -f "${file}.gdb-index"; then > + =A0 objcopy --add-section .gdb_index=3D"${file}.gdb-index" --set-sectio= n-flags .gdb_index=3Dreadonly "$file" "$file" > + =A0 rm -f "${file}.gdb-index" > +fi > + > +exit 0 Should this script be more robust w.r.t. errors? e.g. What happens if gdb exits with a non-zero exit code but still happens to leave a .gdb-index for the `if' to find? What happens if objcopy exits with a non-zero exit code? What happens if the script is invoked with none or too many arguments?