Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: gdb-patches@sourceware.org
Subject: [patch] Flat DW_TAG_module support (PR fortran/9806)
Date: Sat, 07 Feb 2009 14:35:00 -0000	[thread overview]
Message-ID: <20090207143504.GA28253@host0.dyn.jankratochvil.net> (raw)

Hi,

gfortran-4.4 may look as having an regression - GCC PR debug/39073 - as it now
supports Fortran modules "namespaces" by wrapping the DIEs to DW_TAG_module.

GDB currently ignores DW_TAG_module and so the DIEs get completely lost.

This patch is not the real Fortran module support - it only merges the
namespaces as flat - but it fixes the "regression" of gfortran-4.4.

No GDB testsuite regressions on x86_64-unknown-linux-gnu.


Thanks,
Jan


gdb/
2009-02-07  Jan Kratochvil  <jan.kratochvil@redhat.com>

	PR fortran/9806
	* dwarf2read.c (scan_partial_symbols <DW_TAG_module)
	(process_die <DW_TAG_module>): New.

gdb/testsuite/
2009-02-07  Jan Kratochvil  <jan.kratochvil@redhat.com>

	PR fortran/9806
	* gdb.fortran/module.exp, gdb.fortran/module.f90: New.

--- gdb/dwarf2read.c	3 Jan 2009 05:57:51 -0000	1.292
+++ gdb/dwarf2read.c	7 Feb 2009 13:57:26 -0000
@@ -1851,6 +1851,11 @@ scan_partial_symbols (struct partial_die
 	    case DW_TAG_namespace:
 	      add_partial_namespace (pdi, lowpc, highpc, cu);
 	      break;
+	    case DW_TAG_module:
+	      /* FIXME: Support the separate Fortran module namespaces.  */
+	      if (pdi->has_children)
+		scan_partial_symbols (pdi->die_child, lowpc, highpc, cu);
+	      break;
 	    default:
 	      break;
 	    }
@@ -2822,6 +2827,19 @@ process_die (struct die_info *die, struc
       processing_has_namespace_info = 1;
       read_namespace (die, cu);
       break;
+    case DW_TAG_module:
+      /* FIXME: Support the separate Fortran module namespaces.  */
+      if (die->child != NULL)
+	{
+	  struct die_info *child_die = die->child;
+	  
+	  while (child_die && child_die->tag)
+	    {
+	      process_die (child_die, cu);
+	      child_die = sibling_die (child_die);
+	    }
+	}
+      break;
     case DW_TAG_imported_declaration:
     case DW_TAG_imported_module:
       /* FIXME: carlton/2002-10-16: Eventually, we should use the
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gdb/testsuite/gdb.fortran/module.exp	7 Feb 2009 13:57:29 -0000
@@ -0,0 +1,35 @@
+# Copyright 2009 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+set testfile "module"
+set srcfile ${testfile}.f90
+set binfile ${objdir}/${subdir}/${testfile}
+
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f77 quiet}] != "" } {
+    untested "Couldn't compile ${srcfile}"
+    return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+if ![runto MAIN__] then {
+    perror "couldn't run to breakpoint MAIN__"
+    continue
+}
+
+gdb_test "print i" "\\$\[0-9\]+ = 42"
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gdb/testsuite/gdb.fortran/module.f90	7 Feb 2009 13:57:29 -0000
@@ -0,0 +1,22 @@
+! Copyright 2009 Free Software Foundation, Inc.
+! 
+! This program is free software; you can redistribute it and/or modify
+! it under the terms of the GNU General Public License as published by
+! the Free Software Foundation; either version 3 of the License, or
+! (at your option) any later version.
+! 
+! This program is distributed in the hope that it will be useful,
+! but WITHOUT ANY WARRANTY; without even the implied warranty of
+! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+! GNU General Public License for more details.
+! 
+! You should have received a copy of the GNU General Public License
+! along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+module mod
+        integer :: i = 42
+end module mod
+
+        use mod
+        print *, i
+end


             reply	other threads:[~2009-02-07 14:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-07 14:35 Jan Kratochvil [this message]
2009-02-11 19:18 ` Joel Brobecker
2009-02-11 20:15   ` 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=20090207143504.GA28253@host0.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