Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!

Final procedures and debugging

Norman_K_
New Contributor I
64 Views

I have recently noticed that when I have a derived type with a "final" procedure, and I am debugging line by line with F11, when the instance of the derived type moves out of scope at the relevant "end subroutine" statement, the debugger just jumps to the next statement after the original "call", when I would really like it to (i.e. expect it to) jump to the first statement in the final procedure.

Now that I know this is what will happen I can put a break point in the final procedure, and that does work, but I do wonder if this is a "feature" of debugging that has been overlooked, or at least not documented very well.

0 Kudos
3 Replies
Steve_Lionel
Black Belt Retired Employee
64 Views

From the debugger's viewpoint, it is doing what you asked. The finalization is part of the scope exit code, not the next statement. Setting a breakpoint in the final routine is what you'd need to do.

Norman_K_
New Contributor I
64 Views

In the debugger in VS on Windows: F11 is "step into", and F10 is "step over".

I would like and expect F11 to visit every line of my source code that gets executed.

I agree with Steve's response, had I been hitting F10 and sat at the end subroutine statement.

Just a thought (or is it a terrible warning?)

Steve_Lionel
Black Belt Retired Employee
64 Views

You would need to be in assembly view, I think, to step into finalization and even then you'd first enter a library routine which, after a while, calls the finalizer. 

Reply