I am debugging some code that contains many Fortran modules, some of which share variables between each other. Unfortunately, gdb with VScode seems to have trouble inspecting imported variables when debugging.
Currently when I need to inspect an imported variable, the only way to do so is to stop debugging, and manually alter the code to include a local variable equal to the imported variable. In the example below, to find out what value of foo%bar
is passed to the function a_function
I would have to declare a new variable, like so
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
This is obviously very time consuming, and I don't know why VSCode should not be able to inspect global variables. Any ideas? The following are the gfortran compiler flags I currently have turned on in the makefile
-Og -g -Wall -Wextra -Wline-truncation -pedantic -fimplicit-none -fcheck=all -fbacktrace