Printing allocatable array in Fortran with gdb: Unhandled dwarf expression opcode 0x97 [duplicate]

谁说胖子不能爱 提交于 2019-12-24 13:25:52

问题


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,

  • http://numericalnoob.blogspot.be/2012/08/fortran-allocatable-arrays-and-pointers.html
  • Unhandled dwarf expression
  • Fortran print allocatable array in gdb

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.


回答1:


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.



来源:https://stackoverflow.com/questions/33772175/printing-allocatable-array-in-fortran-with-gdb-unhandled-dwarf-expression-opcod

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!