Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: Pedro Alves <pedro@codesourcery.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [patch] release handle on object files after program exits
Date: Wed, 08 Apr 2009 22:51:00 -0000	[thread overview]
Message-ID: <20090408223829.GI7535@adacore.com> (raw)
In-Reply-To: <200904081814.46748.pedro@codesourcery.com>

[-- Attachment #1: Type: text/plain, Size: 939 bytes --]

Hi Pedro,

> I'm left wondering if generic_mourn_inferior wouldn't be a better place
> for this.  That is, at the tail end of mourning, instead of before mourning,
> which e.g., has a better change of not triggering a file reopen.
> generic_mourn_inferior already calls reopen_exec_file, which
> conditionaly calls bfd_cache_close_all.

Looks like generic_mourn_inferior is not necessarily called at
the end of the execution of the program. Lots of targets actually
call it at the end of their own mourn_inferior, but it is conceivable
that some may not.

But you do have a point.  How about the following patch instead?
Instead of closing all descriptors before calling the mourn_inferior
routine, it does it after.

2009-04-08  Joel Brobecker  <brobecker@adacore.com>

        * target.c (target_mourn_inferior): Call bfd_cache_close_all
        after having executed the target mourn_inferior routine.

Tested on x86-windows.

-- 
Joel

[-- Attachment #2: target.c.diff --]
[-- Type: text/x-diff, Size: 590 bytes --]

Index: target.c
===================================================================
--- target.c	(revision 147356)
+++ target.c	(working copy)
@@ -1947,6 +1942,12 @@ target_mourn_inferior (void)
 	  t->to_mourn_inferior (t);
 	  if (targetdebug)
 	    fprintf_unfiltered (gdb_stdlog, "target_mourn_inferior ()\n");
+
+          /* We no longer need to keep handles on any of the object files.
+             Make sure to release them to avoid unnecessarily locking any
+             of them while we're not actually debugging.  */
+          bfd_cache_close_all ();
+
 	  return;
 	}
     }

  reply	other threads:[~2009-04-08 22:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-03 16:44 Joel Brobecker
2009-04-03 18:41 ` Tom Tromey
2009-04-08 16:48   ` Joel Brobecker
2009-04-08 17:14     ` Pedro Alves
2009-04-08 22:51       ` Joel Brobecker [this message]
2009-04-08 23:12         ` Pedro Alves
2009-04-14 16:51         ` Joel Brobecker

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=20090408223829.GI7535@adacore.com \
    --to=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=pedro@codesourcery.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