【发布时间】:2021-07-07 14:31:23
【问题描述】:
我正在调试一些包含许多 Fortran 模块的代码,其中一些模块之间共享变量。不幸的是,使用 VScode 的 gdb 在调试时似乎无法检查导入的变量。
目前,当我需要检查导入的变量时,唯一的方法是停止调试,并手动更改代码以包含与导入变量相等的局部变量。在下面的示例中,要找出将 foo%bar 的什么值传递给函数 a_function,我必须声明一个新变量,就像这样
module setup
type(customDerived) :: foo
foo%bar = 1
end module setup
module example
use setup, only: foo
integer(ik) :: foobar <-- Stop debugging, add these lines, restart and inspect 'foobar'
foobar = foo%bar <--
a_function(foo%bar)
end module example
这显然非常耗时,我也不知道为什么 VSCode 不能检查全局变量。有任何想法吗?以下是我目前在makefile中开启的gfortran编译器标志
-Og -g -Wall -Wextra -Wline-truncation -pedantic -fimplicit-none -fcheck=all -fbacktrace
【问题讨论】:
标签: visual-studio-code fortran gdb gfortran vscode-debugger