public inbox for archer@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Roland McGrath <roland@redhat.com>
Cc: Panu Matilainen <pmatilai@redhat.com>,
	Project Archer <archer@sourceware.org>
Subject: Re: find-debuginfo.sh change for gdb index
Date: Thu, 08 Jul 2010 15:56:00 -0000	[thread overview]
Message-ID: <m3k4p66k7l.fsf@fleche.redhat.com> (raw)
In-Reply-To: <20100706191407.535874824F@magilla.sf.frob.com> (Roland McGrath's message of "Tue, 6 Jul 2010 12:14:07 -0700 (PDT)")

Roland> So one approach would be to replace the debugedit invocation
Roland> with the use of another shell script.

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

It would perhaps have been cleaner to make the gdb command simply
rewrite the objfile directly.  However, this turns out to be relatively
hairy with BFD.  So again, for simplicity I just stuck with invoking
objcopy directly.  I also verified that objcopy will preserve hard
links.

Tom

--- find-debuginfo.sh.orig	2010-06-29 16:19:42.000000000 -0600
+++ find-debuginfo.sh	2010-07-08 09:36:03.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 "maintenance 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

  parent reply	other threads:[~2010-07-08 15:56 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-29 22:32 Tom Tromey
2010-06-29 23:21 ` Roland McGrath
2010-06-30 17:35   ` Tom Tromey
2010-06-30 18:14     ` Roland McGrath
2010-06-30 18:23       ` Tom Tromey
2010-06-30 20:42         ` Tom Tromey
2010-06-30 20:44           ` Roland McGrath
2010-06-30 21:25             ` Tom Tromey
2010-06-30 21:58               ` Tom Tromey
2010-06-30 22:00                 ` Tom Tromey
2010-06-30 22:14               ` Roland McGrath
2010-07-02 19:55                 ` Tom Tromey
2010-07-05  9:36                   ` Panu Matilainen
2010-07-05  9:48                     ` Jan Kratochvil
2010-07-05 10:39                       ` Panu Matilainen
2010-07-06 18:35                     ` Tom Tromey
2010-07-06 19:14                       ` Roland McGrath
2010-07-06 19:41                         ` Tom Tromey
2010-07-06 20:28                           ` Roland McGrath
2010-07-08 15:56                         ` Tom Tromey [this message]
2010-07-08 20:36                           ` Tom Tromey
2010-07-08 22:53                           ` Roland McGrath
2010-07-09  5:07                             ` Panu Matilainen
2010-07-09 17:48                               ` Tom Tromey
2010-07-30 21:36                                 ` Tom Tromey
2010-07-30 23:07                                   ` Roland McGrath
2010-07-30 23:09                                   ` Jan Kratochvil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3k4p66k7l.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=archer@sourceware.org \
    --cc=pmatilai@redhat.com \
    --cc=roland@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).