From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5668 invoked by alias); 7 Feb 2009 14:35:16 -0000 Received: (qmail 5659 invoked by uid 22791); 7 Feb 2009 14:35:15 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx2.redhat.com (HELO mx2.redhat.com) (66.187.237.31) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 07 Feb 2009 14:35:10 +0000 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n17EZ8mN023178 for ; Sat, 7 Feb 2009 09:35:08 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n17EZ8lV003373 for ; Sat, 7 Feb 2009 09:35:08 -0500 Received: from host0.dyn.jankratochvil.net (sebastian-int.corp.redhat.com [172.16.52.221]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n17EZ70H014621 for ; Sat, 7 Feb 2009 09:35:08 -0500 Received: from host0.dyn.jankratochvil.net (localhost [127.0.0.1]) by host0.dyn.jankratochvil.net (8.14.3/8.14.3) with ESMTP id n17EZ5dV028428 for ; Sat, 7 Feb 2009 15:35:06 +0100 Received: (from jkratoch@localhost) by host0.dyn.jankratochvil.net (8.14.3/8.14.2/Submit) id n17EZ4fo028425 for gdb-patches@sourceware.org; Sat, 7 Feb 2009 15:35:04 +0100 Date: Sat, 07 Feb 2009 14:35:00 -0000 From: Jan Kratochvil To: gdb-patches@sourceware.org Subject: [patch] Flat DW_TAG_module support (PR fortran/9806) Message-ID: <20090207143504.GA28253@host0.dyn.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-02/txt/msg00177.txt.bz2 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 PR fortran/9806 * dwarf2read.c (scan_partial_symbols ): New. gdb/testsuite/ 2009-02-07 Jan Kratochvil 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 . + +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 . + +module mod + integer :: i = 42 +end module mod + + use mod + print *, i +end