[ Reported here: https://sourceware.org/pipermail/gdb-patches/2023-October/203488.html ] The v9 .gdb_index contains a shortcut table, but it doesn't always contain information. For instance, this is the case for C and C++ programs. Making this information available in more cases will speed up gdb startup if finding the language of main requires expanding a large CU.
This may be easier once bug#30174 is done. Many languages use minsyms here, which is fast. The danger would be to have a scenario where the DWARF reader picks "main", but in reality gdb should choose some other language (e.g, Ada). But maybe we can special-case "main" in the main-finding function.
(In reply to Tom de Vries from comment #0) > Making this information available in more cases will speed up gdb startup if > finding the language of main requires expanding a large CU. FWIW, implementing lazy expansion ( PR29398 ) might also address this problem sufficiently.