}
}
-/* Set the initial language.
-
- FIXME: A better solution would be to record the language in the
- psymtab when reading partial symbols, and then use it (if known) to
- set the language. This would be a win for formats that encode the
- language in an easily discoverable place, such as DWARF. For
- stabs, we can jump through hoops looking for specially named
- symbols or try to intuit the language from the specific type of
- stabs we find, but we can't do that until later when we read in
- full symbols. */
+/* Set the initial language. */
void
set_initial_language (void)
if (language_mode == language_mode_manual)
return;
enum language lang = main_language ();
+ /* Make C the default language. */
+ enum language default_lang = language_c;
if (lang == language_unknown)
{
const char *name = main_name ();
- struct symbol *sym = lookup_symbol (name, NULL, VAR_DOMAIN, NULL).symbol;
+ struct symbol *sym
+ = lookup_symbol_in_language (name, NULL, VAR_DOMAIN, default_lang,
+ NULL).symbol;
if (sym != NULL)
lang = sym->language ();
if (lang == language_unknown)
{
- /* Make C the default language */
- lang = language_c;
+ lang = default_lang;
}
set_language (lang);
struct symtab *symtab
= OBSTACK_ZALLOC (&objfile->objfile_obstack, struct symtab);
- symtab->filename
- = ((const char *) objfile->per_bfd->filename_cache.insert
- (filename, strlen (filename) + 1));
+ symtab->filename = objfile->intern (filename);
symtab->fullname = NULL;
symtab->language = deduce_language_from_filename (filename);