admin管理员组文章数量:1355045
I'm trying to debug a fortran90 application, using vscode with gdb. In one particular function:
subroutine get_hamiltonian(...)
real :: list(:)
...
end subroutine get_hamiltonian
I can not print the value of variable list
. Specifically, I get this error:
(gdb) list
-var-create: unable to create variable object
I have checked that list is actually correctly instantiated and I have managed to print
the list too, and it works. Somehow, inside gdb, printing the value of list
doesn't work. Why?
I'm trying to debug a fortran90 application, using vscode with gdb. In one particular function:
subroutine get_hamiltonian(...)
real :: list(:)
...
end subroutine get_hamiltonian
I can not print the value of variable list
. Specifically, I get this error:
(gdb) list
-var-create: unable to create variable object
I have checked that list is actually correctly instantiated and I have managed to print
the list too, and it works. Somehow, inside gdb, printing the value of list
doesn't work. Why?
2 Answers
Reset to default 0The problem is that inside GDB, keyword list
is reserved. Specifically:
list linenum
Print lines centered around line number linenum in the current source file.
So, the quickest solution to read the value of that variable is to rename it. For example, if you rename the variable list
-> alist
, then printing alist
will work. For the purposes of debugging the application this should suffice.
Just use print
to print variables using GDB. Having to rename to rename variables in your code just to be able to debug it is absurd.
(gdb) print list
$2 = (1, 2, 3, 4, 5)
本文标签: fortranGDB varcreate unable to create variable objectStack Overflow
版权声明:本文标题:fortran - GDB -var-create: unable to create variable object - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743946772a2566551.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
print list
? – Vladimir F Героям слава Commented Mar 31 at 13:47