return result;
}
-/* Find the language for partial symbol with NAME. */
-
-static enum language
-find_quick_global_symbol_language (const char *name, const domain_enum domain)
-{
- for (objfile *objfile : current_program_space->objfiles ())
- {
- bool symbol_found_p;
- enum language lang
- = objfile->lookup_global_symbol_language (name, domain, &symbol_found_p);
- if (symbol_found_p)
- return lang;
- }
-
- return language_unknown;
-}
-
/* This function contains the common code of lookup_{global,static}_symbol.
OBJFILE is only used if BLOCK_INDEX is GLOBAL_SCOPE, in which case it is
the objfile to start the lookup in. */
Fallback to "main". */
/* Try to find language for main in psymtabs. */
- enum language lang
- = find_quick_global_symbol_language ("main", VAR_DOMAIN);
- if (lang != language_unknown)
- {
- set_main_name ("main", lang);
- return;
- }
+ bool symbol_found_p = false;
+ gdbarch_iterate_over_objfiles_in_search_order
+ (target_gdbarch (),
+ [&symbol_found_p] (objfile *obj)
+ {
+ language lang
+ = obj->lookup_global_symbol_language ("main", VAR_DOMAIN,
+ &symbol_found_p);
+ if (symbol_found_p)
+ {
+ set_main_name ("main", lang);
+ return 1;
+ }
+
+ return 0;
+ }, nullptr);
+
+ if (symbol_found_p)
+ return;
set_main_name ("main", language_unknown);
}