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


>>>>> "Paul" == Paul Pluzhnikov <ppluzhnikov@google.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)
Paul> occur.

Yeah, I suppose.  But it seems clearer and more future-proof to me.

Paul> 2009-08-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
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.

Tom


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