gdb/symtab: check name matches before expanding a CU
commit3a0fae312983989a33608d924ff902d7b78e8ec1
authorDmitry.Neverov <dmitry.neverov@jetbrains.com>
Mon, 6 May 2024 15:09:17 +0000 (6 17:09 +0200)
committerTom Tromey <tromey@adacore.com>
Fri, 17 May 2024 14:02:29 +0000 (17 08:02 -0600)
treeff58b3e1fcdba215e5b939a83aaa825843cc7d97
parent9ea82bfdd612081e21b38ea89d9bb0f836d92814
gdb/symtab: check name matches before expanding a CU

The added check fixes the case when an unqualified lookup
name without template arguments causes expansion of many CUs
which contain the name with template arguments.

This is similar to what dw2_expand_symtabs_matching_symbol does
before expanding the CU.

In the referenced issue the lookup name was wxObjectDataPtr and many
CUs had names like wxObjectDataPtr<wxBitmapBundleImpl>. This caused
their expansion and the lookup took around a minute. The added check
helps to avoid the expansion and makes the symbol lookup to return in
a second or so.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30520
gdb/dwarf2/read.c