Topic: Debugger when stepping through program

(SF 2.41) When running the debugger, stop at a breakpoint, then step line-by-line from there (using step over or step into), the GUI does not just go to the next line each time. It first jumps to a subroutine's END or SUBROUTINE statement (often a different routine from where I am tracing); pressing Step again puts me to the next statement. So you have to press Step twice to get to the next statement executed.

Is this a feature or a bug?

Re: Debugger when stepping through program

The debugger can and will jump around in a few situations, especially if optimizations are not entirely disabled.  When you see this symptom, can you check the current position in the Stack listing in the debugger panel?  I'm wondering, when it jumps to the end, if the debugger actually thinks it is currently in the proper subroutine (or function).

Jeff Armstrong
Approximatrix, LLC

3 (edited by rbarrphd 2018-07-26 16:04:39)

Re: Debugger when stepping through program

Optimization level: None.  Agressive loop optimizations: unchecked

A breakpoint in subroutine P (source code line 875), followed by steps, jumps to/back from END SUBROUTINE C (line 2196), a routine that has not been called lately. Routine P later calls subroutine R (line 1613). Stepping through R with F8 or F9 causes jumps to END SUBROUTINE R2 (line 1790) with first press and to the correct next line in R with the second press. Routine R2 has not been called lately. Sorry I could not find an obvious pattern.

Current stack looks correct:  mainCRTStartup > _tmainCRTStartup > main > fc30 (my PROGRAM FC30) > step2 > descend > P
Routines C, R2 not shown.

Re: Debugger when stepping through program

What platform are you on and what architecture are you compiling for (32- or 64-bit) if you're on Windows?

Just to eliminate any other issues, is your compiled Fortran up-to-date?  Building again doesn't fix the issue?

If you're willing to share it, possibly having the offending code would help track down the issue faster, but I understand if you're unable to do so.  You can always email the project to support@approximatrix.com.

Jeff Armstrong
Approximatrix, LLC

Re: Debugger when stepping through program

Jeff, I am on Win7, 64-bit, latest SF version. Dell Precision with 32GB RAM, Intel i7 with 8 cores.

I will check into sending the code to you...Thanks

Re: Debugger when stepping through program

I have emailed you the code, data files, and instructions to see if you can duplicate the problems and, hopefully, fix.

Re: Debugger when stepping through program

Any updates??? We're running into a similar issue.

Re: Debugger when stepping through program

No updates as of yet.  The issue is caused by the GNU Debugger and the executable itself in the presence of implicit typing (apparently).  Upon entering a procedure, the second step is setting up any implicitly typed variables.  However, there isn't a "line" where the variables are set up, so the GNU Debugger, for whatever reason, reports the line number as the closing of the previous routine.  While it might seem like the debugger is at fault, the line number being reported appears to be fault of the debugging information in the executable itself, meaning that the compiler is producing an incorrect line number within the debugging information.  Trying to hunt down where that is occurring is quite a bit more difficult than trying to sort out an issue with the debugger itself.

The bug still exists, and we're aware of it.  Hunting down the root cause, however, is trickier.

Jeff Armstrong
Approximatrix, LLC