Topic: Debugger Integration

I've been rather quiet on the subject since pointing out that it was in the works, but the debugger integration with Simply Fortran is functionally complete.  With a component of this magnitude being added, some significant testing still remains.  However, on the face of it, everything is working as it should.  I've attached a few screenshots below:

Breakpoints

Breakpoints can be set within the editor, and a list of current breakpoints is always available.  Clicking in the margins of a source file allows setting and clearing breakpoints.

Local Variables

All local variables can be observed at any time.  Arrays, like in most debuggers, must be expanded to see their components.  Similarly, you can expand derived types to see their components as well.

Watch

Variables (global or local) and expressions can be added to a watch list, either by entering the text manually or selecting text and using the editor's right-click menu.  In the example, you can see I've checked if a variable is greater than 1.  Any time a variable or watch expression changes, the entries are highlighted in yellow.

Stack

The call stack is also available.  Double-clicking on any point in the call stack allows you to navigate to the point and view the local variables in the specified frame, as one would expect.

Right now everything is working, but there's plenty more tests to run!  If you have any initial comments, please leave them here.  This integrated debugger will completely replace Insight, so please be ready to say goodbye to Simply Fortran's current debugger shortly.

Jeff Armstrong
Approximatrix, LLC

Re: Debugger Integration

Tell us more.  Have you written the debugger yourself?  That sounds like a very large task.
I am looking forward to seeing this latest development.

One, for me, important shortcoming I've found in Insight is that I can't monitor array variable values in dynamic arrays.
It would be really useful if one could do so. 

I assume it's difficult to do this because the debugger run-time presumably commences before that of the program being run by the debugger, so the the debugged program array dimensions are unknown to the debugger when it starts up and lays out all memory it will need.  If this is a problem, perhaps the debugger could make a fixed amount of space available for each dynamic array, such as to assume all array dimensions are 6 (eg STIFFNESS(*:*) would be taken as STIFFNESS(6:6) ).  The debugger could thereby monitor the first 6 values of each row, in the first 6 rows, of a dynamic array. 

This would enable users to examine a sufficient number of dynamic array variables for most purposes.
---
John

Re: Debugger Integration

Looks good!

John

Re: Debugger Integration

The debugger is still the GNU Debugger underneath, but Insight has been removed from the distribution.  Insight is problematic for two reasons: it uses non-standard, unsupported bindings into the GNU Debugger and, subsequently, it lags behind the official GNU Debugger code base.  Trying to maintain Insight is problematic at best. 

The Simply Fortran integration is achieved using GNU Debugger's Machine Interface, GDB/MI.  This interface is designed specifically for other programs, such as integrated development environments, to communicate with the debugger.  The interface is relatively well-defined and standardized, so upgrading the underlying debugger shouldn't be a problem any longer.

JohnWasilewski wrote:

One, for me, important shortcoming I've found in Insight is that I can't monitor array variable values in dynamic arrays.
It would be really useful if one could do so.

I'm not exactly sure I understand the issue, but in the integrated debugger, you can of course enter any valid array or element of an array as a watch variable at any time.  So prior to starting the debugger, you can enter STIFFNESS or even STIFFNESS(2,1) as a watch variable before the debugging session starts.  The values will simply be marked as indeterminate until the STIFFNESS variable enters scope and is allocated.  Any changes to a single element of an array will be highlighted when they individually change as well, either in the Watch panel or the Variables panel.  Does that answer your question?

Jeff Armstrong
Approximatrix, LLC

Re: Debugger Integration

If an array STIFFNESS(*:*) is dimensioned dynamically then I now see that entering STIFFNESS(2,1) as a watch variable does in fact work (I didn't know I could do that).  Entering just STIFFNESS as a watch variable does not permit individual array elements to be examined, however, like it would do for an array that was explicitly declared by the program.
---
John

Re: Debugger Integration

John,

In the integrated debugger, you'll be able to simply enter STIFFNESS as a watch expression, and, when they become available, you'll be able to examine individually each array entry without any issue.  It will even highlight which entry changed when each changes.

Jeff Armstrong
Approximatrix, LLC

Re: Debugger Integration

If I'll be able to do that even for dynamic arrays, that will be a considerable improvement over debugging as presently available in the Insight GUI you have for GDB in the current version of Simply Fortran.

Consider it eagerly awaited!

I've found SF  to be rock solid stable over the last several releases, by the way.
---
John