[RFA 00/15] Work toward making psymtabs reusable

Tom Tromey
2018-05-10T22:25:20Z

Recently I realized that, while the full objfile splitting project is
still a good idea, many of the potential gains from it could be had
more immediately -- by making psymtabs shareable across objfiles.

The idea behind this is that scanning psymbols is what is noticeably
slow; expanding a given CU is ordinarily pretty fast. So, if psymbols
could be shared, then the most user-visible slowdown could be avoided,
at least in the multi-inferior case.

As an aside, this case matters to me, because Firefox is now
multi-process by default and each process uses the enormous libxul.so.
Multi-inferior debugging still has a ways to go in gdb, but if you are
working in this area, rest assured that there are people who want to
use the results...

This series does not actually achieve the goal of sharing psymbols.
It is just a bunch of necessary-but-not-sufficient infrastructure. I
figured I would send it as it is relatively self-contained and already
pretty long.

Also note that it is built on top of my earlier series to make
psymbols independent of the program space.

This series begins (patches 1-7) with some minor cleanups that I found
while working in this area. Perhaps patches 6 and 7 aren't really
needed; I wrote them when working toward a slightly different end
goal, but I think they are reasonable so I left them in.

Patch 8 is perhaps the ugliest of the bunch. Because backlinks from
pymtabs to per-objfile objects will be disallowed, the
psymtab->compunit_symtab link had to be broken. This patch does so
via a map.

The rest, I think, is reasonably straightforward. Various
psymtab-related objects are moved to a new psymtab state-holding
object, and finally, this object is given its own obstack, moving the
psymbols into a shareable object.

This is the series I referenced in reply to Simon's auto-indexing
series -- I think with this it is pretty easy to picturing handing the
psymtab_storage shared_ptr to a separate thread to write out the index
file.

Regression tested by the buildbot.

There are still some remaining cleanups that could be done. psymtab.c
uses ALL_OBJFILE_PSYMTABS_REQUIRED everywhere, but in some spots it
doesn't make sense. Also, ~objfile (indirectly) calls
psym_forget_cached_source_info, but really psymtab_storage should be
handling this in its own destructor.

Tom