]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
Avoid excessive CU expansion on failed matches
authorTom Tromey <tom@tromey.com>
Fri, 21 Feb 2025 16:18:28 +0000 (09:18 -0700)
committerTom Tromey <tom@tromey.com>
Sat, 8 Mar 2025 00:15:20 +0000 (17:15 -0700)
commitaab2ac34d7f78f0b7a42cef0187dc6e4d7ec4f02
tree3fa71586b82374b5d2cb0a24ff5fd998ecbc1044
parentd519282866163864fff3fe0ab7227ff0339cad67
Avoid excessive CU expansion on failed matches

PR symtab/31010 points out that something like "ptype INT" will expand
all CUs in a typical program.  The OP further points out that the
original patch for PR symtab/30520:

    https://sourceware.org/pipermail/gdb-patches/2024-January/205924.html

... did solve the problem, but the patch changed after (my) review and
reintroduced the bug.

In cooked_index_functions::expand_symtabs_matching, the final
component of a split name is compared with the entry's name using the
usual method of calling get_symbol_name_matcher.

This code iterates over languages and tries to split the original name
according to each style.  But, the Ada splitter uses the decoded name
-- "int".  This causes every C or C++ CU to be expanded.

Clearly this is wrong.  And, it seems to me that looping over
languages and trying to guess the splitting style for the input text
is probably bad.  However, fixing the problem is not so easy (again
due to Ada).  I've filed a follow-up bug, PR symtab/32733, for this.

Meanwhile, this patch changes the code to be closer to the
originally-submitted patch.  This works because the comparison is now
done between the full name and the "lookup_name_without_params"
object, which is a less adulterated variant of the original input.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31010
Tested-By: Simon Marchi <simon.marchi@efficios.com>
gdb/dwarf2/read.c
gdb/testsuite/gdb.dwarf2/no-expand-mixed-case.exp [new file with mode: 0644]