[patch] release handle on object files after program exits

Pedro Alves pedro@codesourcery.com
Wed Apr 8 17:14:00 GMT 2009


A Wednesday 08 April 2009 17:48:39, Joel Brobecker wrote:
> Hi Tom,
> 
> > Joel> 2009-04-03  Joel Brobecker  <brobecker@adacore.com>
> > Joel>         * target.c (target_mourn_inferior): Call bfd_cache_close_all.
> > 
> > I wonder how this will interact with the multi-process support.
> > It seems like too big a hammer.
> 
> I finally had time to look deeper into this - I came up with the patch
> while looking at what we did for the "kill" command, so I didn't have
> to think too much about this.
> 
> As far as I can tell, things should still be fine, because the file
> should automatically be re-opened if GDB tries to read from the bfd
> again. Perhaps we could possibly improve the situation, but I propose
> we do that if the current approach becomes an actual problem? (in which
> case we can look at fixing both cases - kill and exit)
> 

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.

-- 
Pedro Alves



More information about the Gdb-patches mailing list