Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: gdb-patches@sourceware.org
Subject: [patch] release handle on object files after program exits
Date: Fri, 03 Apr 2009 16:44:00 -0000	[thread overview]
Message-ID: <20090403164347.GN16605@adacore.com> (raw)

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

Hello,

One of our Windows users reported that he was not able to delete
the exe file even after the program was run to completion. As it
turns out, we did fix something similar a while ago but only when
the program was kill-ed.

The attached patch fixes the problem in the case when the program
is let to run to completion.

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

        * target.c (target_mourn_inferior): Call bfd_cache_close_all.

Tested on x86_64-linux. Also tested on x86-windows using AdaCore's
testsuite.

I will write a testcase for this one. I have to run now, but I wanted
to put this patch out, in case someone has some comments about it.
Will commit in a few days if no objection.

One thing that crossed my mind while working on this is wondering
whether it would make sense for target_kill to call target_mourn_inferior
at the end. Right now, it looks like a lot (most? all?) implementations
of the target_kill method call target_mourn_inferior...

-- 
Joel

[-- Attachment #2: mourn.diff --]
[-- Type: text/x-diff, Size: 527 bytes --]

diff --git a/gdb/target.c b/gdb/target.c
index 86cdb71..3c37ee4 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -1934,6 +1934,12 @@ void
 target_mourn_inferior (void)
 {
   struct target_ops *t;
+
+  /* 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 ();
+
   for (t = current_target.beneath; t != NULL; t = t->beneath)
     {
       if (t->to_mourn_inferior != NULL)	

             reply	other threads:[~2009-04-03 16:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-03 16:44 Joel Brobecker [this message]
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
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=20090403164347.GN16605@adacore.com \
    --to=brobecker@adacore.com \
    --cc=gdb-patches@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