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

Dmitry Neverov via Gdb
2023-10-13T08:58:36Z

Hi Tom,

I've debugged it a bit more and the number of CUs is indeed
different. Without indexes gdb loads 506 CUs during one slow
symbol lookup, with indexes no CUs are
loaded ('qf_require_partial_symbols()' returns empty list inside
'objfile::lookup_symbol'). Is it something expected? If not,
could you please suggest how to debug it further?

On Tue, Aug 1, 2023 at 8:42 AM Dmitry Neverov <dmitry.neverov@jetbrains.com>
wrote:

> Tom> To figure this out, we'd probably need a test case. Maybe comparing
> the
> Tom> results between the two scenarios with "set debug symtab-create on"
> Tom> would indicate something.
>
> I have a reproducer, but it is somewhat tricky to build. It is
> also not my program, so I'm not sure if I can simplify it.
>
> The program is KiCad (https://gitlab.com/kicad/code/kicad.git).
> Build dependencies for Ubuntu can be obtained from the packaging
> files: https://dev-docs.kicad.org/en/build/linux/#_dependencies.
>
> Once KiCad is built I run the following commands in gdb:
>
> (gdb) file /home/nd/w/CLionProjects/kicad/build/debug/pcbnew/pcbnew
> (gdb) b /home/nd/w/CLionProjects/kicad/pcbnew/footprint_edit_frame.cpp:114
> (gdb) run
>
> When KiCad's window is opened I invoke the menu item "Tools >
> Footprint Editor" to hit the created breakpoint, and then run:
>
> (gdb) interpreter-exec mi2 "-var-create var1_this * \"this\""
> (gdb) interpreter-exec mi2 "-var-list-children --all-values \"var1_this\"
> -1 -1"
> (gdb) interpreter-exec mi2 "-var-list-children --all-values
> \"var1_this.private\" 0 8"
>
> The last command takes most of the time. The .gdbinit only sets up logging:
>
> set trace-commands on
> set logging overwrite on
> set logging debugredirect on
> set logging enabled on
> set debug symtab-create 1
>
> I've captured the logs, they are quite big, the zip (15Mb) is here:
>
> https://drive.google.com/file/d/1Cz-HOOqus6xwf_eIjBqcs727w8aOqco4/view?usp=sharing
> .
>
> There are 3 files in archive:
>
> - gdb.txt.index-cache-disabled - the slow run with index-cache
> disabled
>
> - gdb.txt.index-cache-enabled-run1 - the first run with
> index-cache enabled - it is still slow
>
> - gdb.txt.index-cache-enabled-run2 - the second run with
> index-cache enabled - fast
>
>