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> I seem to have hit a rough patch with my patches :-(

Yeah, that happens to me too.

Paul> This is happening because in symbol_add_stub refcount may not be set:
so-> objfile = symbol_file_add_from_bfd (so->abfd, flags, sap, OBJF_SHARED);
---> QUIT could be executed deep inside symbol_file_add_from_bfd, and
---> bfd_userdata below is never set.

Paul>    p_refcount = xmalloc (sizeof (*p_refcount));
Paul>    *p_refcount = 2;  /* Both solib and objfile refer to this abfd.  */
Paul>    bfd_usrdata (so->abfd) = p_refcount;

I haven't had time to read this patch fully and try to understand it.

It just struck me from a first reading that it would be simpler, and
more conventional, to have a "gdb_bfd_ref" function, to go along with
gdb_bfd_unref, which we call whenever we assign a 'bfd*' to a field
somewhere.

What do you think?

Tom


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