aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog10
-rw-r--r--gdb/dwarf2read.c8
-rw-r--r--gdb/symfile.c14
-rw-r--r--gdb/symtab.c3
-rw-r--r--gdb/symtab.h1
5 files changed, 31 insertions, 5 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 3cdd41c..d1f4477 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,4 +1,14 @@
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>
* gdbthread.h (currently_stepping): New declaration.
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index e92795b..7c78454 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -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;
diff --git a/gdb/symfile.c b/gdb/symfile.c
index cfbfd55..f1c2941 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -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)
{
diff --git a/gdb/symtab.c b/gdb/symtab.c
index baf6d94..a6023b9 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -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;
}
}
diff --git a/gdb/symtab.h b/gdb/symtab.h
index be1a746..a4032f8 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -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,