public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: gdb-patches@sourceware.org
Subject: [patch] regression on gfortran-4.5: stopped language detection
Date: Sun, 19 Sep 2010 20:54:00 -0000	[thread overview]
Message-ID: <20100919163507.GA2742@host1.dyn.jankratochvil.net> (raw)

Hi,

with gcc-4.5.x there is a regression:
FAIL: gdb.fortran/module.exp: stopped language detection

due to the main program no longer being global:
PASS:
 <1><d0>: Abbrev Number: 7 (DW_TAG_subprogram)
    <d1>   DW_AT_external    : 1
    <d2>   DW_AT_name        : (indirect string, offset: 0x39): module
    <d?>   DW_AT_calling_convention: 2  (program)
FAIL:
 <1><d4>: Abbrev Number: 7 (DW_TAG_subprogram)
    <d5>   DW_AT_name        : (indirect string, offset: 0x19): module
    <d?>   DW_AT_calling_convention: 2  (program)

PASS GNU Fortran (GCC) 4.4.5 20100919 (prerelease)
PASS gcc-4.4.4-10.fc13.x86_64
FAIL GNU Fortran (GCC) 4.5.2 20100919 (prerelease)
FAIL GNU Fortran (GCC) 4.6.0 20100919 (experimental)
FAIL gcc-4.5.1-3.fc14.x86_64

No regressions on {x86_64,x86_64-m32,i686}-fedora{13,14snapshot}-linux-gnu.


Thanks,
Jan


gdb/
2010-09-19  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) <name_of_main != NULL>: Reset LANGUAGE_OF_MAIN.
	* symtab.h (language_of_main): New declaration.

--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -8863,7 +8863,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;
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -1565,12 +1565,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)
     {
--- 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,6 +4398,7 @@ set_main_name (const char *name)
     {
       xfree (name_of_main);
       name_of_main = NULL;
+      language_of_main = language_unknown;
     }
   if (name != NULL)
     {
--- 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,

             reply	other threads:[~2010-09-19 16:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-19 20:54 Jan Kratochvil [this message]
2010-10-17 18:51 ` [commit] " Jan Kratochvil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100919163507.GA2742@host1.dyn.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).