This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [0/4] RFC: add DWARF index support
>> I don't think this can happen.
Doug> ... assuming there are no bugs.
Ok.
What do you think of this?
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:46:00 -0000
@@ -19,11 +19,19 @@
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.
+ rm -f "${file}.gdb-index"
+ exit 1
+}
+# 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