2

I am using GNU Fortran Compiler on Windows with Eclipse Fotran IDE. For debugging, I am trying to get contents of array in Eclipse. However, I did not find any good to resolve my problem.

If I set breakpoints and write arr(1,1) it gives garbage result, even though the array contains meaningful values. I was especially interested in viewing row-wise array contents, say arr(1,:), arr(2,:)

I referred to this: How to print Fortran arrays in GDB? but I am trying to do it in the IDE.

There is another good post of how to display arrays in Eclipse, but it did not work for fortran. Eclipse-C++-Debugging: see content of an Array When I right click the variable, there is no option to do the same what posted in this question.

Any comments how to do this?

EDIT: I wrote a simple program and compiled with gdb debugger.

PROGRAM test3
IMPLICIT NONE

REAL,DIMENSION(5) :: ARR1
REAL,DIMENSION (3,3) :: ARR2
ARR1=(/1,2,3,4,5/)
ARR2 = reshape((/ 1, 2, 3, 4, 5, 6, 7, 8, 9 /), shape(ARR2))

WRITE(*,100) 'ARR1 = ',ARR1
100 FORMAT (F0.0)

WRITE(*,100) 'ARR2 = ',ARR2

END PROGRAM

Compiled: gfortran -g test3.f90 -o test3

Debugger:

gdb test3
break main
run
step

After stepping a few times,

print ARR2
$2 = (( 1, 2, 3) ( 4, 5, 6) ( 7, 8, 9) )

So, I got the array contents from the gdb in command line. But I want to do the same in IDE. Any ideas?

user3705273
  • 325
  • 6
  • 14

0 Answers0