Loading some symbols, when, and index-cache

Lluís Batlle i Rossell viric@viric.name
Sun Apr 6 15:07:37 GMT 2025


Hello,

I'm trying to make sense of what symbols are loaded and when, in gdb.
For example, opening an elf file, it will build some index (usable as
index-cache) of some symbols, but not all.

If I do "gdb gdb" (for my compiled gdb), and then "maint print stat" I
get:

  Number of "minimal" symbols read: 33435
  Number of read CUs: 0
  Number of unread CUs: 682

Why haven't all CUs been read, and incorporated into the index? Because at
file loading the CUs symbols index is generated with worker threads (read.c),
therefore, potentially using all cores of the system. And the result would
be cached in the index-cache.

Because the next thing I notice is that when I type "list def<TAB>" to get
symbol completion, a very slow single-thread symbol expansion causes many CUs
to be loaded. After which:, "maint print stat":

  Number of "minimal" symbols read: 33435
  Number of "full" symbols read: 2732412
  Number of "types" defined: 4292812
  Number of symbol tables: 57075
  Number of symbol tables with line tables: 9608
  Number of symbol tables with blockvectors: 351
  Number of read CUs: 351
  Number of unread CUs: 331

Is there any way this work can be done ahead? Why the index-cache only helps
for the "minimal" symbols? How can we use the cache for all symbols? Why not
all CUs have been loaded yet?

Regards,
Lluís.


More information about the Gdb mailing list