gdb/
authorJan Kratochvil <jan.kratochvil@redhat.com>
Sun, 17 Oct 2010 18:49:47 +0000 (18:49 +0000)
committerJan Kratochvil <jan.kratochvil@redhat.com>
Sun, 17 Oct 2010 18:49:47 +0000 (18:49 +0000)
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.

gdb/ChangeLog
gdb/dwarf2read.c
gdb/symfile.c
gdb/symtab.c
gdb/symtab.h

index 3cdd41c91511138f98cfdf344226653f7afaa76d..d1f44770ddccfbe4302b80e04f61de364c1764ae 100644 (file)
@@ -1,3 +1,13 @@
+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>
 
index e92795b5873084ecf44f88f953d815a59f6fd5cf..7c784545d399554330c4f4d5c183433fa3ed1da1 100644 (file)
@@ -8880,7 +8880,13 @@ read_partial_die (struct partial_die_info *part_die,
             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;
index cfbfd55e3ff48e8da47e17a927afe5ce82673eaf..f1c2941d3945fa3481a6737869687fa98a577b00 100644 (file)
@@ -1568,12 +1568,18 @@ symbol_file_command (char *args, int from_tty)
 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)
     {
index baf6d940d768f8e882fe13a443f2e777211d3bb6..a6023b9abf24b73edabc5821db0dc4d9c492dff3 100644 (file)
@@ -4389,6 +4389,7 @@ decode_line_spec (char *string, int funfirstline)
 
 /* Track MAIN */
 static char *name_of_main;
+enum language language_of_main = language_unknown;
 
 void
 set_main_name (const char *name)
@@ -4397,10 +4398,12 @@ 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;
     }
 }
 
index be1a7461064b4d0f5cfbd08a179ea9efc77c9888..a4032f8ec5ee1142408d0ec6747cf309d544535f 100644 (file)
@@ -1238,6 +1238,7 @@ extern struct cleanup *make_cleanup_free_search_symbols (struct symbol_search
    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,