Sources Bugzilla – Bug 14125
Performance issue with .gdb_index and large numbers of shared libs
Last modified: 2012-06-23 22:27:05 UTC
When .gdb_index is in use there isn't a bit that specifies GLOBAL_BLOCK vs
STATIC_BLOCK, so if something is in STATIC_BLOCK (say "int") it matches so gdb
will expand the symbol table, but the match doesn't take into account the block
kind. So gdb will proceed to expand one symbol table from every objfile looking
for "int" in GLOBAL_BLOCK, finding it, but not using it.
Only after that is done will GDB try STATIC_BLOCK.
In a large enough app (e.g., >1000 shared libs) this is painful.
For this my plan is to indicate in the index whether a symbol is in
GLOBAL_BLOCK or STATIC_BLOCK.
Another thing that I've been wondering about is adding an indication of whether
a symbol is a type, function, variable, etc. IIRC there's a performance issue
where that would help (I need to try to find it - IWBN to only change the index
/* We only want to add a given psymbol once. However, we also
want to account for whether it is global or static. So, we
may add it twice, using slightly different values. */
uintptr_t val = 1 | (uintptr_t) *psymp;
lookup = (void *) val;
lookup = *psymp;
Module name: src
Changes by: email@example.com 2012-06-23 22:23:48
gdb : ChangeLog NEWS dwarf2read.c
gdb/doc : ChangeLog gdb.texinfo
* NEWS: Document additions to .gdb_index.
* dwarf2read.c: #include "gdb/gdb-index.h".
(DW2_GDB_INDEX_SYMBOL_STATIC_SET_VALUE): New macro.
(DW2_GDB_INDEX_SYMBOL_KIND_SET_VALUE): New macro.
(DW2_GDB_INDEX_CU_SET_VALUE): New macro.
(dwarf2_read_index): Recognize version 7.
(dw2_do_expand_symtabs_matching): New args want_specific_block,
block_kind, domain): All callers updated.
(dw2_find_symbol_file): Handle new index CU values.
(dw2_expand_symtabs_matching): Match symbol kind if requested.
(add_index_entry): New args is_static, kind. All callers updated.
(offset_type_compare, uniquify_cu_indices): New functions
(symbol_kind): New function.
(write_psymtabs_to_index): Remove duplicate CU values.
(write_psymtabs_to_index): Write .gdb_index version 7.
* gdb.texinfo (Index Section Format): Document version 7 format.
* gdb-index.h: New file.