Re: How to get the variable list (GFortran)



Hello Hubert,

On 21 December 2016 at 07:40, Hubert Figuière <hub figuiere net> wrote:
I tried with some FORTRAN 90 and it did work as expected, ie the
variables are listed, etc.

Do you have it build with -g ?

Yes, I did. Also note that Nemiver can see the variables if it wants to. The issue is that I manually have to tell it to show me each variable.

 
Otherwise do you have simple FORTRAN 2008 program that reproduce the issue?
(I'm not a FORTRAN developer)



Sure. But the issue is not unique to Fortran. So I'll show you examples with both Fortran and C:


------------------------------
$ gfortran --version|head -n 1
GNU Fortran (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609

$ gcc --version|head -n 1
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609

$ cat hello.f90program hello
    
    real :: x = 1.0, y = 2.0
    
    print *,"Hello world"
    print *,x,y
    
    ! Test changing the values of variables.
    x = x + y
    y = 2*y
    
    print *,x,y
    
end program

$ cat hello.c
#include<stdio.h>
#include<stdlib.h>

int main()
{
    float x = 1.0, y = 2.0;
    
    printf("Hello world\n");
    printf("%f\n", x + y);
    
    /* Test changing the values of variables. */
    x = x + y;
    y = 2*y;
    printf("%f\n", x + y);
    
    return 0;
}
------------------------------

I compile both the same way:

------------------------------
$ gfortran -g -Wall hello.f90 -o hello

$ nemiver hello

$ gcc -g -Wall hello.c -o hello

$ nemiver hello
------------------------------

The results are almost the same. The main difference is that with the C program gdb is smart enough to insert a break point at the beginning of the main() function and with Fortran there are no break points of any kind by default, so you have to add one. But besides that, they are identical. I can see the source code, and I can inspect the value of variables if I go through the steps that I listed earlier:

 - Right-click on "In scope expressions"
 - Enter variable name.
 - Click "Inspect".
 - Click "Add to monitor".


Thanks for the help.

Cheers,
Daniel.

PS: A completely unimportant side-comment. In 1990 they officially changed the spelling of the language from "FORTRAN" to "Fortran".  This was done at the same time as a major language reform meant to modernize the language. People still use the all-caps spelling when referring to the pre-reform versions, the latest of which is from 1977.






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]