public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Dmitry Neverov via Gdb <gdb@sourceware.org>
Cc: Dmitry Neverov <dmitry.neverov@jetbrains.com>
Subject: Re: Index files are not used in the session where they were created
Date: Wed, 26 Jul 2023 10:20:18 -0600	[thread overview]
Message-ID: <87351ak5kt.fsf@tromey.com> (raw)
In-Reply-To: <CAEY59_KmafbXkjSVk1kp-dFxp6RA3Srs2aUPu6a-euXtbM-Buw@mail.gmail.com> (Dmitry Neverov via Gdb's message of "Tue, 25 Jul 2023 10:01:49 +0200")

>>>>> "Dmitry" == Dmitry Neverov via Gdb <gdb@sourceware.org> 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

  reply	other threads:[~2023-07-26 16:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-25  8:01 Dmitry Neverov
2023-07-26 16:20 ` Tom Tromey [this message]
2023-08-01  6:42   ` Dmitry Neverov
2023-10-13  8:57     ` Dmitry Neverov
2023-10-25 15:59       ` Dmitry Neverov
2023-11-01 17:51         ` Tom Tromey
2023-11-06 10:41           ` Dmitry Neverov
2023-11-13 16:59           ` Dmitry Neverov
2023-11-15 10:18           ` Dmitry Neverov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87351ak5kt.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=dmitry.neverov@jetbrains.com \
    --cc=gdb@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).