From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17493 invoked by alias); 8 Apr 2009 22:51:18 -0000 Received: (qmail 17484 invoked by uid 22791); 8 Apr 2009 22:51:17 -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; Wed, 08 Apr 2009 22:51:13 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 646792BACB9; Wed, 8 Apr 2009 18:51:11 -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 00EYVau89K-u; Wed, 8 Apr 2009 18:51:11 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 1BB5B2BACD7; Wed, 8 Apr 2009 18:40:31 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 8F838F5A13; Wed, 8 Apr 2009 15:38:29 -0700 (PDT) Date: Wed, 08 Apr 2009 22:51:00 -0000 From: Joel Brobecker To: Pedro Alves Cc: gdb-patches@sourceware.org Subject: Re: [patch] release handle on object files after program exits Message-ID: <20090408223829.GI7535@adacore.com> References: <20090403164347.GN16605@adacore.com> <20090408164839.GD7535@adacore.com> <200904081814.46748.pedro@codesourcery.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="2oS5YaxWCcQjTEyO" Content-Disposition: inline In-Reply-To: <200904081814.46748.pedro@codesourcery.com> 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/msg00164.txt.bz2 --2oS5YaxWCcQjTEyO Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 939 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 * target.c (target_mourn_inferior): Call bfd_cache_close_all after having executed the target mourn_inferior routine. Tested on x86-windows. -- Joel --2oS5YaxWCcQjTEyO Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="target.c.diff" Content-length: 590 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; } } --2oS5YaxWCcQjTEyO--