Re: Index files are not used in the session where they were created

Tom Tromey <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <[email protected]>
>>>>> "Dmitry" == Dmitry Neverov via Gdb <[email protected]> writes:

Dmitry> I'm investigating whether index-caches help with slow symbols
Dmitry> loading (https://sourceware.org/bugzilla/show_bug.cgi?id=30520).

...

Dmitry> If I then try loading children of a variable causing a slow symbol
Dmitry> lookup, the lookup is still slow. Even though the index is ready
Dmitry> and is saved to disk.

Dmitry> If I restart gdb after the index is written, then gdb picks it
Dmitry> up, and symbol loading is much faster - a few seconds instead of
Dmitry> a minute.

Dmitry> Is there a way to use the created index without gdb restart?

Actually I'm surprised to hear that the index makes a difference in this
case.  It would be good to understand this better -- maybe there's a
bug.

The reason I say that is that gdb has a "two phase" DWARF reader.

The first phase scans the DWARF, building a symbol table.  In the index
case, this just means mapping in the index (and maybe doing a bit of
processing).

Currently, gdb will pause until this phase is complete.  That is, if you
run "gdb -nx" and use "file some-executable", the prompt won't return
until scanning is done.


After this is what is called "full CU expansion".  If you print a
variable or set a breakpoint (or otherwise cause gdb to need debug
info), gdb will re-read the DWARF for selected compilation units,
expanding the ones it thinks are necessary.

This phase only has a single implementation -- it does not depend on how
the scanning was done.  This is why it's surprising that the index would
make a difference here.

That said, the two scanners might differ on how they select which CUs to
expand.  I'd guess that is what you are seeing.  Maybe it means that the
index is failing in some situation -- or maybe it means we could make
the DWARF scanner implementation a bit faster by having it expand less.

To figure this out, we'd probably need a test case.  Maybe comparing the
results between the two scenarios with "set debug symtab-create on"
would indicate something.

Tom
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.