diff options
author | Jan Kratochvil <jan.kratochvil@redhat.com> | 2010-10-17 18:49:47 +0000 |
---|---|---|
committer | Jan Kratochvil <jan.kratochvil@redhat.com> | 2010-10-17 18:49:47 +0000 |
commit | 01f8c46dda6579913074a1d04eca0ad7fc437f47 (patch) | |
tree | a0dfa003d324672c6b0f0cbd95c2d1c27bfc6368 /gdb | |
parent | 8aeb23f3648c6ef10c5715e30f04563d1cc28709 (diff) | |
download | gdb-01f8c46dda6579913074a1d04eca0ad7fc437f47.zip gdb-01f8c46dda6579913074a1d04eca0ad7fc437f47.tar.gz gdb-01f8c46dda6579913074a1d04eca0ad7fc437f47.tar.bz2 |
gdb/
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.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 10 | ||||
-rw-r--r-- | gdb/dwarf2read.c | 8 | ||||
-rw-r--r-- | gdb/symfile.c | 14 | ||||
-rw-r--r-- | gdb/symtab.c | 3 | ||||
-rw-r--r-- | gdb/symtab.h | 1 |
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, |