Fix the `stopped language detection' testcase for gcc-4.5.
* dwarf2read.c (read_partial_die): Set also LANGUAGE_OF_MAIN.
* symfile.c (set_initial_language): Move variable filename to a more
inner block. Prefer LANGUAGE_OF_MAIN.
* symtab.c (language_of_main): New variable.
(set_main_name): Always reset LANGUAGE_OF_MAIN.
* symtab.h (language_of_main): New declaration.
+2010-10-17 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ Fix the `stopped language detection' testcase for gcc-4.5.
+ * dwarf2read.c (read_partial_die): Set also LANGUAGE_OF_MAIN.
+ * symfile.c (set_initial_language): Move variable filename to a more
+ inner block. Prefer LANGUAGE_OF_MAIN.
+ * symtab.c (language_of_main): New variable.
+ (set_main_name): Always reset LANGUAGE_OF_MAIN.
+ * symtab.h (language_of_main): New declaration.
+
2010-10-17 Jan Kratochvil <jan.kratochvil@redhat.com>
Pedro Alves <pedro@codesourcery.com>
practice. */
if (DW_UNSND (&attr) == DW_CC_program
&& cu->language == language_fortran)
- set_main_name (part_die->name);
+ {
+ set_main_name (part_die->name);
+
+ /* As this DIE has a static linkage the name would be difficult
+ to look up later. */
+ language_of_main = language_fortran;
+ }
break;
default:
break;
void
set_initial_language (void)
{
- const char *filename;
enum language lang = language_unknown;
- filename = find_main_filename ();
- if (filename != NULL)
- lang = deduce_language_from_filename (filename);
+ if (language_of_main != language_unknown)
+ lang = language_of_main;
+ else
+ {
+ const char *filename;
+
+ filename = find_main_filename ();
+ if (filename != NULL)
+ lang = deduce_language_from_filename (filename);
+ }
if (lang == language_unknown)
{
/* Track MAIN */
static char *name_of_main;
+enum language language_of_main = language_unknown;
void
set_main_name (const char *name)
{
xfree (name_of_main);
name_of_main = NULL;
+ language_of_main = language_unknown;
}
if (name != NULL)
{
name_of_main = xstrdup (name);
+ language_of_main = language_unknown;
}
}
const. */
extern void set_main_name (const char *name);
extern /*const */ char *main_name (void);
+extern enum language language_of_main;
/* Check global symbols in objfile. */
struct symbol *lookup_global_symbol_from_objfile (const struct objfile *objfile,