使用gdb在Fortran中打印可分配数组:未处理的矮表达式操作码0x97 [英] Printing allocatable array in Fortran with gdb: Unhandled dwarf expression opcode 0x97

查看:183
本文介绍了使用gdb在Fortran中打印可分配数组:未处理的矮表达式操作码0x97的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用gdb作为调试器,在Cygwin和Eclipse中调试了以下代码:

 程序代码测试
隐式无

整数,参数:: dp = kind(1.0d0)
整数,参数:: N = 10
实数(dp),维数(:), allocatable :: vector
integer :: i

allocate(vector(1:N))

forall(i = 1:10)
vector (*,'(F7.3,1X)',advance ='no')(vector((i)= sqrt(real(i,dp))
end forall

i),i = 1,N)

解除分配(向量)
结束程序codetest

运行gdb时,我尝试在分配后打印可分配数组vector,但最终得到以下结果:

pre > (gdb)p vector
未处理的矮表达式操作码0x97

我已经搜遍了Stack Overflow和Google,但是我还没有发现任何可以解决问题的核心。我检查了以下内容,


  • http://numericalnoob.blogspot.be/2012/08/fortran-allocatable-arrays-and-pointers.html
  • >
  • 未处理的矮人表达

  • Fortran在gdb中打印可分配数组

  • ul>

    但我仍然不理解问题是什么或如何解决它。在尝试打印/显示派生类型的内容时,我从Eclipse中获得了gdb的相同投诉(Mars.1 Release,4.5.1)。目前有关我的机器/编译器/调试器的规格包括:


    • Windows 8.1

    • gfortran版本:GNU Fortran(GCC)4.9.3

    • gdb版本:GNU gdb(GDB)7.8 b
      p>>

      解决方案

      正如在评论中指出的那样,我只需要更新我的gdb版本,我通过Cygwin完成的。我现在使用与以前版本相同的gfortran版本运行gdb版本7.9.1-1。


      I've debugged the following piece of code in Cygwin and Eclipse using gdb as the debugger:

      program codetest
          implicit none
      
          integer, parameter :: dp = kind(1.0d0)
          integer, parameter :: N = 10
          real(dp), dimension(:), allocatable :: vector
          integer :: i
      
          allocate(vector(1:N))
      
          forall(i = 1:10)
              vector(i) = sqrt(real(i, dp))
          end forall
      
          write(*, '(F7.3, 1X)', advance = 'no') (vector(i), i = 1, N)
      
          deallocate(vector)
      end program codetest
      

      When running gdb, I attempt to print the allocatable array "vector" following its allocation, but I end up with the following:

      (gdb) p vector
      Unhandled dwarf expression opcode 0x97
      

      I've scoured Stack Overflow and Google, but I haven't found anything that gets to the heart of the matter. I've checked out the following,

      but I'm still not understanding what the problem is or how to fix it. I've gotten the same complaint from gdb in Eclipse (Mars.1 Release, 4.5.1) when trying to print/display the contents of a derived type. Current specs about my machine/compiler/debugger include the following:

      • Windows 8.1
      • gfortran version: GNU Fortran (GCC) 4.9.3
      • gdb version: GNU gdb (GDB) 7.8

      Any help is appreciated.

      解决方案

      As was pointed out in the comments, I just needed to update my version of gdb, which I did via Cygwin. I'm now running gdb version 7.9.1-1 with the same version of gfortran as before.

      这篇关于使用gdb在Fortran中打印可分配数组:未处理的矮表达式操作码0x97的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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