This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] release handle on object files after program exits


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
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;
 	}
     }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]