gdb在fortran的应用例子(转载自stackoverflow)

有关于gdb在fortran的应用

  1. source fortran
module modname
  integer :: var1 = 1 , var2 = 2
end module modname

use modname, only: newvar => var2
newvar = 7
end

2.gfortran

$ gfortran -g -o mytest test.f90; gdb --quiet ./mytest
Reading symbols from /dev/shm/mytest...done.
(gdb) b 6
Breakpoint 1 at 0x4006a0: file test.f90, line 6.
(gdb) run
Starting program: /dev/shm/mytest
Breakpoint 1, MAIN__ () at test.f90:6
6       newvar = 7
(gdb) p newvar
$1 = 2
(gdb) p var1
No symbol "var1" in current context.
(gdb) p modname::var1
$2 = 1
(gdb) p modname::var2
$3 = 2
(gdb) n
7       end
(gdb) p modname::var2
$4 = 7
(gdb)