This is the mail archive of the gdb-patches@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: [0/17] RFC: share minimal symbols across objfiles


>>>>> "Tom" == Tom Tromey <tromey@redhat.com> writes:

Tom> This patch series changes gdb to allow some sharing of data across
Tom> objfiles.  In particular this series adds sharing of minimal symbols.

Tom> The big idea here is that most data in an objfile is actually
Tom> independent of the inferior.  So, if multiple inferiors refer to the
Tom> data, we should be able to read it just once and then share.

I recently thought of a problem with this patch series.

If an inferior uses dlmopen to load a .so multiple times, then the
patched gdb will fail.  The problem is that the series (in particular
patch #14) assumes that a given minimal symbol appears a single time in
the inferior; but with dlmopen it may appear multiple times.

I'm still not sure of the best way to fix this problem.  One idea is to
have the various searching functions return a {minsym, objfile} pair,
rather than just a pointer to the minimal symbol.  This would be a
pretty big (if mostly mechanical) patch, though.

Another approach I've considered a little is having gdb create relocated
minimal symbols on the fly, and cache them per-objfile.  Then the lookup
functions can always return these cached, relocated minsyms.  This uses
a bit more memory (but presumably not too bad -- most symbols aren't
used); but it is also obviously just a hack to work around a design
flaw.  On the whole I think the first idea is cleaner.

Maybe there is some other approach that would work.

I think I'd like to resurrect parts of this series (the BFD refcounting
and filename changes, and registry.h) and put them in, since they are
reasonable (IMO :) cleanups in their own right.

Tom


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