1 (edited by JohnWasilewski 2014-02-23 19:55:20)

Topic: Watching structured-data dynamic array variables

Is it intended that SF's debugger should be able to display the contents of the first few values of dynamic arrays in data structures?  I ask, because when I seem to be finding it can't display these.

For example, I have the following declarations:

      Type :: MEMBER
           INTEGER           :: NODE1, NODE2
           INTEGER           :: MTyp
           LOGICAL           :: Released(6)
           LOGICAL           :: StiffsStored
           REAL*8            :: LStiff(21)
           REAL*8            :: GStiff(21)
           CHARACTER(24)     :: Desc
      END TYPE

      TYPE(MEMBER), ALLOCATABLE :: MEMB(:)

During debugging, I am finding, for example, if I highlight the code string,  MEMB(1)%LStiff(4), then hover the mouse pointer over the highlighted selection, the debugger displays a garbage value for that array variable element.  I am nearly sure that this is not because the array element in fact contains garbage (though I could be mistaken).  Should the debugger in fact be managing to display this information?
---
John

Re: Watching structured-data dynamic array variables

John,

The Simply Fortran debugger certainly does allow examining the individual members of derived types and statically declared arrays of said derived types.  However, there is currently a shortcoming in the underlying GNU Debugger that does not allow examining the contents of ALLOCATEd arrays regardless of each elements type.  Had you declared

INTEGER, ALLOCATABLE :: MEMB(:)

you still would not be able to examine the contents regardless of the array's allocation status.  You can examine the contents via a complicated watch expression (one element at a time), but it's unwieldy to the point of being useless.

This shortcoming is currently being resolved via a set of "Variable Length Array" patches to GNU Debugger.  Once these patches are integrated into the debugger, Simply Fortran will "just work," allowing you to inspect the contents of dynamically allocated arrays.

If you're feeling brave, you can read more about the changes on the GNU Debugger mailing list.

Jeff Armstrong
Approximatrix, LLC