This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

a problem of debuging module variables with gdb


Hi, ALL:
I try to use GDB to debug my f90 code, but find that gdb can never correctly show the variable declared in modules.


There is a sample code:

$ cat hello.f90
   module test_mod
       implicit none
       real(8) :: a,b,c
    end module test_mod

     program testf90
     use test_mod,only: a,b,c
     implicit none
     real(8) :: al
      a =3.0_8
      b =4.0_8
      al = a+b
     write(*,*)'al=',al
     end program testf90

Then I compile it with gfortran -g -o hello hello.f90 and debug with gdb hello.
I got the following results:


(gdb) break hello.f90:13
Breakpoint 1 at 0x1c30: file hello.f90, line 13.
(gdb) run
Starting program: /Users/rqin/Documents/helloworld/hello
Reading symbols for shared libraries ++. done

Breakpoint 1, 0x00001c30 in MAIN__ () at hello.f90:10
10            a =3.0_8
(gdb) next
11            b =4.0_8
(gdb) next
12            al = a+b
(gdb) next
13           write(*,*)'al=',al
(gdb) print a
$1 = 3.1611237438705655
(gdb) print b
$2 = 23.601290952344122
(gdb) print al
$3 = 7

Clearly, GDB can not resolve the variables from module. I have searched the mailing archive but find no clue on this.
Is this the problem of gfortran that it can not provide the information of module variables to GDB or the GDB simply can't work with f90 standard to debug module variables?
It would be very appreciated if someone would give me a clue. The system I'm using is Mac OS X 10.3.8. The gfortran is 20050128 version and GDB is version 5.3.




Ran


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]