This is the mail archive of the archer@sourceware.org mailing list for the Archer project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: find-debuginfo.sh change for gdb index


Tom> Here is a patch to just do the work directly in find-debuginfo.sh.  This
Tom> seemed simpler to me, but if you and Panu want a new script, I will do
Tom> that.

An upstream maintainer wanted the command's name changed.
It is now "save gdb-index" instead of "maint save-gdb-index".

Here's the updated find-debuginfo.sh patch.

Tom

--- find-debuginfo.sh.orig	2010-06-29 16:19:42.000000000 -0600
+++ find-debuginfo.sh	2010-07-08 14:10:06.000000000 -0600
@@ -96,6 +96,15 @@
   chmod 444 "$1" || exit
 }
 
+# Create a .gdb-index file for $1.
+make_gdb_index()
+{
+  local f="$1"
+  local d="${f%/*}"
+  # We don't care if gdb gives an error.
+  gdb --batch-silent -ex "file $f" -ex "save gdb-index $d" > /dev/null 2>&1
+}
+
 # Make a relative symlink to $1 called $3$2
 shopt -s extglob
 link_relative()
@@ -207,6 +216,12 @@
     $strict && exit 2
   fi
 
+  make_gdb_index "$f"
+  if [ -f "${f}.gdb-index" ]; then
+    objcopy --add-section .gdb_index="${f}.gdb-index" --set-section-flags .gdb_index=readonly "$f" "$f"
+    rm -f "${f}.gdb-index"
+  fi
+
   # A binary already copied into /usr/lib/debug doesn't get stripped,
   # just has its file names collected and adjusted.
   case "$dn" in


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]