This is the mail archive of the
mailing list for the GDB project.
Re: Solibs and objfile BFD ownership
>>>>> "Paul" == Paul Pluzhnikov <email@example.com> writes:
Paul> It would be slightly wasteful to set refcount to 1 everywhere,
Paul> since solib is the only place where sharing could (currently)
Yeah, I suppose. But it seems clearer and more future-proof to me.
Paul> 2009-08-19 Paul Pluzhnikov <firstname.lastname@example.org>
Paul> * objfiles.h (gdb_bfd_ref): New prototype.
Paul> * objfiles.c (gdb_bfd_ref): New function.
Paul> (allocate_objfile): Call it.
Paul> (gdb_bfd_unref): Adjust assertion.
Paul> * solib.c (solib_map_sections): Add reference.
Paul> (symbol_add_stub): Don't add reference here.
Paul> * symfile.c (reread_symbols): Add reference.
This is ok. Thanks.
Paul> + gdb_assert (*p_refcount == 1 || *p_refcount == 2);
This assertion is a bit strange, but I suppose it is harmless. If we
ever want more sharing, we can always just remove it. In the meantime I
suppose it is checking that we don't over-share somehow.