[patch] Flat DW_TAG_module support (PR fortran/9806)
Jan Kratochvil
jan.kratochvil@redhat.com
Sat Feb 7 14:35:00 GMT 2009
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
More information about the Gdb-patches
mailing list