GDB 可以用于在 Fortran 90 中打印派生类型的可分配数组的值吗? [英] Can GDB be used to print values of allocatable arrays of a derived type in Fortran 90?

查看:34
本文介绍了GDB 可以用于在 Fortran 90 中打印派生类型的可分配数组的值吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Fortran90 程序中有以下数据结构:

I have the following data structure in a Fortran90 program:

TYPE derivedType
  CHARACTER(100)     :: name      = ' '
  INTEGER            :: type      = 0
  REAL(KIND(1.0D0))  :: property  = 0.0
END TYPE derivedType

TYPE (derivedType), ALLOCATABLE, DIMENSION(:) :: arrayOfDerivedTypes

当我尝试在 GDB 中调试和打印值时:

When I try to debug and print values in GDB like:

(gdb) p arrayOfDerivedTypes(1)%name

我得到无意义的值(通常是零、正斜杠和字母的字符串)或完全错误的值(如 arrayOfDerivedTypes(1)%name = 9,当我知道它是 = 2 时).如何让 GDB 打印正确的值?

I get non-sensical values (often strings of zeros, forward slashes and letters), or completely wrong values (like arrayOfDerivedTypes(1)%name = 9, when I know that it is = 2). How can I get GDB to print the correct values?

我知道:

我不想麻烦编译一个单独的 GDB 分支来测试它是否能解决这个问题,如果有人已经知道它不会或者是否有更好的解决方案可用.

I don't want to go through the trouble of compiling a separate branch of GDB to test if it solves this problem if someone already knows that it won't or if there is a better solution available.

我很难想象目前还没有解决方案.fortran 社区是否还没有更好的免费调试器解决方案?

I have a hard time imagining that there is not a solution to this yet. Does the fortran community not have a better solution for a free debugger yet?

推荐答案

我知道可能答案有点不对,但是 Sun studio (sdb) 和 intel fortran 也带有调试器

I know may answer is a little off but Sun studio (sdb) and intel fortran also come with a debugger

这篇关于GDB 可以用于在 Fortran 90 中打印派生类型的可分配数组的值吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆