Highlighted
Super Contributor.
Super Contributor.
58 views

Feature Request: "Suspend On 'STOP RUN'" feature improvement

Jump to solution

Currently, having the "Tools > Options > Debugging > Micro Focus COBOL > Suspend at 'STOP RUN'" option set, the debugger visually appears to stop before the final line is being executed:

Suspend at 'STOP RUN' - 1.png

 

From above screenshot you can see that it looks like the CALL statement has not been executed yet. But actually, execution has already passed the final line in the code.

This current behaviour is very irritating.


Furthermore, I'm used to continue (by hitting <F5>) a successful program when it's halted instead of aborting it (by hitting <SHIFT>+<F5>). So, it's cumbersome to alter that common behaviour just for the "Suspend On 'STOP RUN'" feature (see error message above).

 

So, I'd like to suggest four improvements regarding the "Suspend On 'STOP RUN'" feature:

  1. When building a DEBUG build, have the COBOL linker add a terminating __debugbreak operation (or Debugger.Break method) to the generated code to have the debugger always stop there.

    By analyzing the program counter when that final opcode is reached you can easily identify this halt as the "Suspend On 'STOP RUN'" debugger break and either continue the program (when the option setting is disabled) or just have the debugger halt at that position (when the option setting is enabled).


  2. Map the source code for above mentioned final __debugbreak/Debugger.Break operation beyond the final line in code or to the final, solitary dot in code, so the yellow program position pointer shall point to what is expected to be the end of the source code:

Suspend at 'STOP RUN' - 2.png

 

  1.  
  2.  
  3. Make the "Suspend On 'STOP RUN'" setting available either in Solution Explorer or in the COBOL toolbar, as it tends to be rather a temporary setting than a permanent one.

  4. The Micro Focus documentation states that the STOP statement is an obsolete element that's about to be purged from being supported in the future. So, I'd like to suggest that the option setting should be renamed to "Suspend when completing final statement".

 

0 Likes
1 Solution

Accepted Solutions
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: Feature Request: "Suspend On 'STOP RUN'" feature improvement

Jump to solution

Thanks for your suggestions. I agree that the inability to exit out of the program by pressing Resume or Step after the STOP RUN is a bit irritating. Currently the only way to exit is to stop debugging. 

In your case it stops on the CALL statement because that is the last executable statement in your program so the compiler inserts an implied STOP RUN after this statement but the debugger cannot be positioned to an implied statement. The END PROGRAM is not an executable statement nor is a period by itself.

Since the STOP RUN has already been executed at the time the break is encountered the program has actually terminated. Running the program further doesn't make sense as there are no further executable statements.

I will create a request to have the current behavior changed if it is possible.

BTW, it is only the STOP "literal" statement that has been obsoleted. STOP and STOP RUN are not obsolete.

Thanks

View solution in original post

2 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: Feature Request: "Suspend On 'STOP RUN'" feature improvement

Jump to solution

Thanks for your suggestions. I agree that the inability to exit out of the program by pressing Resume or Step after the STOP RUN is a bit irritating. Currently the only way to exit is to stop debugging. 

In your case it stops on the CALL statement because that is the last executable statement in your program so the compiler inserts an implied STOP RUN after this statement but the debugger cannot be positioned to an implied statement. The END PROGRAM is not an executable statement nor is a period by itself.

Since the STOP RUN has already been executed at the time the break is encountered the program has actually terminated. Running the program further doesn't make sense as there are no further executable statements.

I will create a request to have the current behavior changed if it is possible.

BTW, it is only the STOP "literal" statement that has been obsoleted. STOP and STOP RUN are not obsolete.

Thanks

View solution in original post

Highlighted
Super Contributor.
Super Contributor.

Re: Feature Request: "Suspend On 'STOP RUN'" feature improvement

Jump to solution
Thanks a lot for your help, Chris. Thank you so much for being so supportive 👍👍👍

Ah, and thank you for this very enlightening distinction about the different applications of STOP in code.

Cheers,
Axel
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.