This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Solibs and objfile BFD ownership
- From: Daniel Jacobowitz <drow at false dot org>
- To: Paul Pluzhnikov <ppluzhnikov at google dot com>, gdb at sourceware dot org
- Date: Tue, 28 Jul 2009 11:40:01 -0400
- Subject: Solibs and objfile BFD ownership
I'm seeing ARM test failures caused by this patch:
2009-03-05 Paul Pluzhnikov <ppluzhnikov@google.com>
* printcmd.c (do_one_display): Reparse exp_string.
(display_uses_solib_p): New function.
(clear_dangling_display_expressions): New function.
(_initialize_printcmd): Add observer.
* solib.c (no_shared_libraries): Swap order of calls to
clear_solib and objfile_purge_solibs.
Specifically this bit:
/* The order of the two routines below is important: clear_solib notifies
the solib_unloaded observers, and some of these observers might need
access to their associated objfiles. Therefore, we can not purge the
solibs' objfiles before clear_solib has been called. */
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.
Any thoughts? I could change the ARM code to work around this, but
that means banning access to objfile->obfd during a not well specified
range of functions. Handing off the ownership of the BFD seems like
it would be messy.
--
Daniel Jacobowitz
CodeSourcery