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?

3
  • Are you sure your version of gdb supports Fortran array desciptors (see stackoverflow.com/questions/11786958/…)? First make it work in gdb, only then move one to the IDE. Commented Apr 12, 2015 at 9:22
  • @VladimirF I added the gdb commands and result. So, array printing works in gdb and I want to do it in IDE. Any ideas? Commented Apr 12, 2015 at 15:43
  • Any comments on displaying array contents in debugging mode? Commented Apr 14, 2015 at 22:56

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.