Bug 9806

Summary: does not find local variables of module procedures.
Product: gdb Reporter: Joost VandeVondele <Joost.VandeVondele>
Component: fortranAssignee: Jan Kratochvil <jan>
Status: RESOLVED FIXED    
Severity: normal CC: gdb-prs, jan
Priority: P2    
Version: 6.8   
Target Milestone: 6.8   
Host: Target:
Build: Last reconfirmed:

Description Joost VandeVondele 2009-02-02 12:12:11 UTC
With Fortran code compiled with gcc 4.4.0 (i.e. current trunk), gdb can not
print /find local variables of module procedures. This was filed as a gcc PR
here, with a small testcase:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39073#c2

but it was suggested that the unwind info looks fine, and this is a bug with gdb
instead:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39073#c5
Comment 1 Jan Kratochvil 2009-02-07 14:41:16 UTC
Post for FSF GDB:
http://sourceware.org/ml/gdb-patches/2009-02/msg00177.html

The testcase from http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39073#c2

GNU gdb (GDB) 6.8.50.20090207-cvs
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
(gdb) b 6
Breakpoint 1 at 0x400674: file aaa.f90, line 6.
(gdb) r
Starting program: /tmp/aaa 

Breakpoint 1, a () at aaa.f90:6
6	      if(i == 8) call abort()
Current language:  auto; currently fortran
(gdb) p i
$1 = 1
Comment 2 Sourceware Commits 2009-02-12 09:15:23 UTC
Subject: Bug 9806

CVSROOT:	/cvs/src
Module name:	src
Changes by:	jkratoch@sourceware.org	2009-02-12 09:15:07

Modified files:
	gdb            : ChangeLog dwarf2read.c 
	gdb/testsuite  : ChangeLog 
Added files:
	gdb/testsuite/gdb.fortran: module.exp module.f90 

Log message:
	gdb/
	PR fortran/9806
	* dwarf2read.c (process_die <DW_TAG_module>, read_module)
	(scan_partial_symbols <DW_TAG_module>, add_partial_module): New.
	
	gdb/testsuite/
	PR fortran/9806
	* gdb.fortran/module.exp, gdb.fortran/module.f90: New.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.10187&r2=1.10188
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/dwarf2read.c.diff?cvsroot=src&r1=1.294&r2=1.295
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/testsuite/ChangeLog.diff?cvsroot=src&r1=1.1807&r2=1.1808
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.fortran/module.exp.diff?cvsroot=src&r1=NONE&r2=1.1
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.fortran/module.f90.diff?cvsroot=src&r1=NONE&r2=1.1

Comment 3 Joost VandeVondele 2009-02-12 09:17:55 UTC
(In reply to comment #2)
Thanks!
Comment 4 Jan Kratochvil 2009-02-12 09:34:03 UTC
Checked-in.