[gdb/symtab] Handle interesting_symbols in read_file_scope

Use the interesting_symbols vector to filter the DIEs that we process when
doing read_file_scope.

At this point we start to get the benefit of lazy expansion:
...
$ time gdb -q -iex "maint set lazy-expand-symtab 0" -batch \
    lto/cc1 -ex "b do_rpo_vn"
Breakpoint 1 at 0xd40e30: do_rpo_vn. (2 locations)
real: 5.69
user: 5.47
system: 0.20
...
and with:
...
$ time gdb -q -iex "maint set lazy-expand-symtab 1" -batch \
    lto/cc1 -ex "b do_rpo_vn"
Breakpoint 1 at 0xd40e30: do_rpo_vn. (2 locations)
real: 2.75
user: 2.71
system: 0.10
...
This commit is contained in:
Tom de Vries
2021-06-21 15:50:51 +02:00
parent fa33eebfca
commit e816520954

View File

@@ -10549,9 +10549,32 @@ read_file_scope (struct die_info *die, struct dwarf2_cu *cu)
handle_DW_AT_stmt_list (die, cu, fnd.comp_dir, lowpc); handle_DW_AT_stmt_list (die, cu, fnd.comp_dir, lowpc);
/* Process all dies in compilation unit. */ /* Process all dies in compilation unit. */
for (child_die = die->child; child_die != nullptr && child_die->tag != 0; if (lazy_expand_symtab_p && cu->per_cu->interesting_symbols
child_die = child_die->sibling) && cu->per_cu->interesting_symbols->size () > 0)
process_die (child_die, cu); {
auto interesting_symbol_it = cu->per_cu->interesting_symbols->cbegin ();
for (child_die = die->child; child_die != nullptr && child_die->tag != 0;
child_die = child_die->sibling)
{
if (interesting_symbol_it == cu->per_cu->interesting_symbols->cend ())
break;
sect_offset interesting_symbol = *interesting_symbol_it;
if (interesting_symbol > child_die->sect_off)
continue;
gdb_assert (interesting_symbol == child_die->sect_off);
std::advance (interesting_symbol_it, 1);
process_die (child_die, cu);
}
}
else
for (child_die = die->child; child_die != nullptr && child_die->tag != 0;
child_die = child_die->sibling)
process_die (child_die, cu);
per_objfile->sym_cu = nullptr; per_objfile->sym_cu = nullptr;