[0/4] RFC: add DWARF index support
Doug Evans
dje@google.com
Fri Aug 6 17:15:00 GMT 2010
On Thu, Aug 5, 2010 at 12:56 PM, Tom Tromey <tromey@redhat.com> wrote:
> Doug> What happens if the script is invoked with none or too many arguments?
>
> Oops, forgot this one.
>
> New patch.
>
> Tom
>
> 2010-08-05 Tom Tromey <tromey@redhat.com>
>
> * 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 5 Aug 2010 19:56:24 -0000
> @@ -16,14 +16,27 @@
> # You should have received a copy of the GNU General Public License
> # along with this program. If not, see <http://www.gnu.org/licenses/>.
>
> +if test $# -ne 1; then
> + echo "Usage: gdb-add-index FILE" 1>&2
> + exit 1
> +fi
> +
> file="$1"
> dir="${file%/*}"
>
> -gdb --batch-silent -ex "file $file" -ex "save gdb-index $dir"
> +gdb --batch-silent -ex "file $file" -ex "save gdb-index $dir" || {
> + # Just in case.
status=$?
> + rm -f "${file}.gdb-index"
> + exit 1
exit $status
> +}
>
> +# In some situation gdb can exit without creating an index. This is
> +# not an error.
> +status=0
> if test -f "${file}.gdb-index"; then
> objcopy --add-section .gdb_index="${file}.gdb-index" --set-section-flags .gdb_index=readonly "$file" "$file"
> + status=$?
> rm -f "${file}.gdb-index"
> fi
>
> -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.
More information about the Gdb-patches
mailing list