aboutsummaryrefslogtreecommitdiff
path: root/gdb/symtab.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2023-04-17 12:42:46 -0400
committerSimon Marchi <simon.marchi@efficios.com>2023-04-21 14:09:42 -0400
commit129bce36048028ea9aac972a75b993ba657aa03b (patch)
treeef7370a3b18f6502d7c12a479745b03e14680b70 /gdb/symtab.c
parentf57d81815f865817c8b4bc9a521cb0f71710d871 (diff)
downloadbinutils-129bce36048028ea9aac972a75b993ba657aa03b.zip
binutils-129bce36048028ea9aac972a75b993ba657aa03b.tar.gz
binutils-129bce36048028ea9aac972a75b993ba657aa03b.tar.bz2
gdb: remove language_auto
I think that the language_auto enumerator and the auto_language class can be removed. There isn't really an "auto" language, it's only a construct of the "set language" command to say "pick the appropriate language automatically". But "auto" is never the current language. The `current_language` points to the current effective language, and the fact that we're in "auto language" mode is noted by the language_mode global. - Change set_language to handle the "auto" (and "local", which is a synonym) early, instead of in the for loop. I think it makes the two cases (auto vs explicit language) more clearly separated anyway. - Adjust add_set_language_command to hard-code the "auto" string, instead of using the "auto" language definition. - Remove auto_language, rename auto_or_unknown_language to unknown_language and move the bits of the existing unknown_language in there. - Remove the set_language at the end of _initialize_language. I think it's not needed, because we call set_language in gdb_init, after all _initialize functions are called. There is some chance that an _initialize function that runs after _initialize_language implicitly depends on current_language being set, but my testsuite runs haven't found anything like that. - Use language_unknown instead of language_auto when creating a minimal symbol (minimal_symbol_reader::record_full). I think that this value is used to indicate that we don't know the symbol of the minimal symbol (yet), so language_unknown makes sense to me. Update a condition accordingly in ada-lang.c. symbol_find_demangled_name also appears to "normalize" this value from "unknown" to "auto", remove that part and update the condition to just check for language_unknown. Change-Id: I47bcd6c15f607d9818f2e6e413053c2dc8ec5034 Reviewed-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdb/symtab.c')
-rw-r--r--gdb/symtab.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 6b6905d..9e1e8e9 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -887,10 +887,7 @@ symbol_find_demangled_name (struct general_symbol_info *gsymbol,
gdb::unique_xmalloc_ptr<char> demangled;
int i;
- if (gsymbol->language () == language_unknown)
- gsymbol->m_language = language_auto;
-
- if (gsymbol->language () != language_auto)
+ if (gsymbol->language () != language_unknown)
{
const struct language_defn *lang = language_def (gsymbol->language ());
@@ -1028,7 +1025,7 @@ general_symbol_info::compute_and_set_names (gdb::string_view linkage_name,
(*slot)->demangled = std::move (demangled_name);
(*slot)->language = language ();
}
- else if (language () == language_unknown || language () == language_auto)
+ else if (language () == language_unknown)
m_language = (*slot)->language;
m_name = (*slot)->mangled.data ();