[0/7] RFC: read DWARF psymtabs in the background

Tom Tromey tromey@redhat.com
Mon Jun 14 18:22:00 GMT 2010


This is a patch series to implement reading psymtabs for DWARF in the
background.

The motivation for this is a better user experience.  With this series,
gdb starts up dramatically faster, because we can hide much of the
reading in the background:

gdb -batch -nx ./gdb
Without:  2.37user 0.45system 0:03.47elapsed
With:     0.23user 0.04system 0:00.34elapsed

This example measures time-to-the-prompt.  Once at the prompt, if you do
some operation needing psymtabs, gdb will wait until they have been read
in.

It also works when attaching to a program with a lot of objfiles.  Here
is startup for attach to OO.o Writer:

gdb -batch -p NNNN
Without: 40.44user 2.19system 1:36.94elapsed
With:     2.20user 0.24system 0:04.32elapsed

It is not dramatically better in all cases:

gdb -batch -ex "thread apply all bt full" -p NNN
Without: 44.31user 2.31system 1:39.16elapsed
With:    46.01user 2.88system 1:21.92elapsed

In this case we end up waiting for most of the debuginfo to be read.
I have some other changes, coming later, that help with this.


All the code is written so that threads are optional.  On platforms
without threads, everything works as before, albeit in a somewhat more
convoluted way.

There are still some unpolished edges in this series.  I will try to
call these out in the specific patches.

As you might imagine it is rather tough to be certain that this code is
truly thread-safe.  GDB has plenty of hidden global variables, shared
state, etc.  I'll explain my approach to making this as safe as I could
in the appropriate patches.

Note that the patches probably don't build independently.  I didn't
really try that; I just split them up along conceptual lines.


I realize that threads are unpopular in many quarters, so this is an RFC.

I think I regtested this, but it is hard to recall.  Anyway it doesn't
matter -- I will do that when I fix the little problems that remain.

Tom



More information about the Gdb-patches mailing list