public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
From: tromey@sourceware.org
To: archer-commits@sourceware.org
Subject: [SCM]  tromey/split-objfile/msymbol-location-independence: make "file" use the BFD cache better
Date: Thu, 17 Oct 2013 18:03:00 -0000	[thread overview]
Message-ID: <20131017180348.30762.qmail@sourceware.org> (raw)

The branch, tromey/split-objfile/msymbol-location-independence has been updated
       via  2de926f10f4b2e1e79b773e5cb1a2c158f8d2a39 (commit)
      from  d25a723b8e23a4893cc5f59400442fa7eb783373 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit 2de926f10f4b2e1e79b773e5cb1a2c158f8d2a39
Author: Tom Tromey <tromey@redhat.com>
Date:   Thu Oct 17 12:03:06 2013 -0600

    make "file" use the BFD cache better
    
    Right now the "file" command will discard the exec_bfd and then
    possibly open a new one.
    
    If this ends up reopening the same file, it can cause needless work by
    gdb -- destroying all the per-BFD data just to re-read it again.
    
    This patch changes the code to hold a reference to the old exec_bfd
    while opening the new one.
    
    The possible downside of this is a higher peak memory use.
    
    	* exec.c (exec_file_attach): Hold a reference to exec_bfd.

-----------------------------------------------------------------------

Summary of changes:
 gdb/exec.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

First 500 lines of diff:
diff --git a/gdb/exec.c b/gdb/exec.c
index 758cdc1..d186f5d 100644
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -167,6 +167,14 @@ exec_file_clear (int from_tty)
 void
 exec_file_attach (char *filename, int from_tty)
 {
+  struct cleanup *cleanups;
+
+  /* First, acquire a reference to the current exec_bfd.  We release
+     this at the end of the function; but acquiring it now lets the
+     BFD cache return it if this call refers to the same file.  */
+  gdb_bfd_ref (exec_bfd);
+  cleanups = make_cleanup_bfd_unref (exec_bfd);
+
   /* Remove any previous exec file.  */
   exec_close ();
 
@@ -181,7 +189,6 @@ exec_file_attach (char *filename, int from_tty)
     }
   else
     {
-      struct cleanup *cleanups;
       char *scratch_pathname, *canonical_pathname;
       int scratch_chan;
       struct target_section *sections = NULL, *sections_end = NULL;
@@ -204,7 +211,7 @@ exec_file_attach (char *filename, int from_tty)
       if (scratch_chan < 0)
 	perror_with_name (filename);
 
-      cleanups = make_cleanup (xfree, scratch_pathname);
+      make_cleanup (xfree, scratch_pathname);
 
       /* gdb_bfd_open (and its variants) prefers canonicalized pathname for
 	 better BFD caching.  */
@@ -260,9 +267,10 @@ exec_file_attach (char *filename, int from_tty)
       /* Tell display code (if any) about the changed file name.  */
       if (deprecated_exec_file_display_hook)
 	(*deprecated_exec_file_display_hook) (filename);
-
-      do_cleanups (cleanups);
     }
+
+  do_cleanups (cleanups);
+
   bfd_cache_close_all ();
   observer_notify_executable_changed ();
 }


hooks/post-receive
--
Repository for Project Archer.


                 reply	other threads:[~2013-10-17 18:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20131017180348.30762.qmail@sourceware.org \
    --to=tromey@sourceware.org \
    --cc=archer-commits@sourceware.org \
    /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).