Remove best_symbol and better_symbol
This patch removes best_symbol and better_symbol.
Before some c-exp.y changes this year, best_symbol was the source of
excess CU expansion, because searches that include SEARCH_VAR_DOMAIN
will keep going until a symbol is found in that domain, or until all
matches have been exhausted. So, for instance a "SEARCH_VFT" search
for "int" will, most likely, expand all CUs -- even though the
argument implies that a type would be suitable.
Nowadays, best_symbol is more of an aesthetic offense and abstraction
violation, encoding a workaround for a C++ expression lookup bug into
a low-level lookup function.
This patch changes the the C parser to simply do two lookups,
prioritizing SEARCH_VAR_DOMAIN. This way, it gets the result it is
presumably looking for, without causing excessive expansion (if that's
currently possible) and without pushing its requirements into generic
code.
Note that the special case for "stub" symbols remains. This one is
less problematic, at least for the time being, as such symbols aren't
common. (Kevin does have a patch pending in this area but I don't
believe this change should affect it, as the stub symbol case remains
unchanged.)
New in v2: addressed review comments and reworded the commit text.
v1 is here:
https://inbox.sourceware.org/gdb-patches/
87345e71b1.fsf@tromey.com/T/#meb7622f6d4d5bb0c1cd6170d875b37a0ceb9a1ed
Regression tested on x86-64 Fedora 40.