我正在尝试使用gdb(GNU gdb(Ubuntu / Linaro 7.4-2012.04-0ubuntu2.1)和gfortran(gcc版本4.6.3)调试以下代码。如果我启动gdb并逐步完成子例程的乐趣,我想在模块class_test中打印派生类型“ mytype”的变量使用命令:print class_test :: int很容易在模块“ class_test”中打印变量“ int”,我的问题是如何打印变量int1,int2 ... int4如果gdb逐步执行了子例程fun?
!! 类定义
module class_test
integer :: int = 1
type, public :: mytype
private
integer :: int1 = 2
integer :: int2 = 3
integer :: int3 = 4
integer :: int4 = 5
contains
procedure, pass(this) :: fun
end type mytype
contains
subroutine fun ( this )
class(mytype) :: this
write (*,*) "subroutine"
end subroutine fun
end module class_test
!! Program
program test
use class_test
type(mytype) …Run Code Online (Sandbox Code Playgroud)