This is the mail archive of the gdb@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: Solibs and objfile BFD ownership


On Tue, Jul 28, 2009 at 8:40 AM, Daniel Jacobowitz<drow@false.org> wrote:

>  clear_solib ();
>  objfile_purge_solibs ();
>
> The problem with doing things in this order is that both the solib and
> the objfile have a reference to the same BFD.  The solib is
> responsible for releasing it (OBJF_KEEPBFD).  arm_objfile_data_cleanup
> accesses objfile->obfd during free_objfile, to find the number
> of sections; at that point it's already been free'd.

That is a problem.

> Any thoughts?

There doesn't appear to be a correct order of destruction :-(

Attached patch restores the original order, while still keeping
solib_unloaded observers from accessing danglig objfiles.

I do not know if there is a better way to fix this.

Tested on Linux/x86_64 with no new regressions.

Thanks,
-- 
Paul Pluzhnikov

2009-07-29  Paul Pluzhnikov  <ppluzhnikov@google.com>

	* solib.c (clear_solib): Rename to clear_solib_1
	(clear_solib): New function.
	(no_shared_libraries): Adjust.

Attachment: gdb-clear-solib-20090729.txt
Description: Text document


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