From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19201 invoked by alias); 3 Apr 2009 16:44:02 -0000 Received: (qmail 19015 invoked by uid 22791); 3 Apr 2009 16:44:00 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 03 Apr 2009 16:43:54 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id BCD812C76B7 for ; Fri, 3 Apr 2009 12:43:52 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 2551u96R+7ah for ; Fri, 3 Apr 2009 12:43:52 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 8444F2C76B1 for ; Fri, 3 Apr 2009 12:43:52 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 70AA9F5A6F; Fri, 3 Apr 2009 09:43:47 -0700 (PDT) Date: Fri, 03 Apr 2009 16:44:00 -0000 From: Joel Brobecker To: gdb-patches@sourceware.org Subject: [patch] release handle on object files after program exits Message-ID: <20090403164347.GN16605@adacore.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="DBIVS5p969aUjpLe" Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-04/txt/msg00074.txt.bz2 --DBIVS5p969aUjpLe Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 988 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 * 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 --DBIVS5p969aUjpLe Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="mourn.diff" Content-length: 527 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) --DBIVS5p969aUjpLe--