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

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

问题描述

  TYPE derivedType 
CHARACTER(100)::在Fortran90程序中有以下数据结构: name =''
INTEGER :: type = 0
REAL(KIND(1.0D0)):: property = 0.0
END TYPE derivedType
$ b $ TYPE(derivedType) ,ALLOCATABLE,DIMENSION(:) :: arrayOfDerivedTypes

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

 (gdb)p arrayOfDerivedTypes(1)%name 

当我知道非理性值(通常是零串,正斜杠和字母串)或完全错误的值(如arrayOfDerivedTypes(1)%name = 9)它是= 2)。我怎样才能让GDB打印正确的值?



背景



我知道:

>



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



时间想象没有还没有解决这个问题。 Fortran社区是否没有更好的免费调试器解决方案?

解决方案

我知道可能会有一些答案,但Sun工作室(sdb)和intel fortran也带有一个调试器

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

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

(gdb) p arrayOfDerivedTypes(1)%name

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?

Background

I am aware of:

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.

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?

解决方案

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天全站免登陆