Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28591 Discussions

Problems in debugging 64 bit after hitting break point

olmakr
Beginner
320 Views
Hello, Did anyone experienced problem in icrementing after breal point is set?
While debugging in 64 bit through Visual Studuo, If I use break point around (before and after) line with incrementing the integer: I=I+1, the incrementing procedure is not performed, i.e. i see0=0+1 (or n=n+1). If I remove break point, calculations are fine.
0 Kudos
4 Replies
IanH
Honored Contributor II
320 Views
Are you using conditional break points?
0 Kudos
olmakr
Beginner
320 Views
Thank you for your responce. I am using regular break points just for debugging. It looks like break points trigger the problems with incrementing. Did you somemething like this before?
0 Kudos
jimdempseyatthecove
Honored Contributor III
320 Views
If you are debugging optimized code, then you might not see the variable incrimented. The variable may have been copied into a register, and the register incrimented, or the variable might have been removed should its value be known to the compiler.

SUBROUTINE VECADD(A,B,C)
REAL(4) :: A(3), B(3), C(3)
INTEGER :: I
I = 1
C(I) = A(I) + B(I)
I = I + 1
C(I) = A(I) + B(I)
I = I + 1
C(I) = A(I) + B(I)
END SUBROUTINE VECADD

In release build (optimizations enabled) and assume not inlined the compiler would generate something the equivilentof

SUBROUTINE VECADD(A,B,C)
REAL(4) :: A(3), B(3), C(3)
C(1) = A(1) + B(1)
C(2) = A(2) + B(2)
C(3) = A(3) + B(3)
END SUBROUTINE VECADD

Your source could would still show the I but no variable is used (in optimized code)

You will see similar behavior with loop control variables

DO I=1,N

Depending on optimizations your debug session might not follow changes to I, as it may reside in a register, and vectorization may be advancing the loop in strides of 2, 4, 8, ...

Jim Dempsey
0 Kudos
dannycat
New Contributor I
320 Views
I've experienced the same problem. Not only does the increment change the value of the variable in the debuggerthe value ofvariable in memoryis not updated either. In other words the debugger is showing, what it thinks is) the actualvalue of the variable. In my application the debug configuration does not have any optimizations set.

Sometimes this problem goes away if you close down visual studio and restart it. I'm not sure of the cause but restarting VS usually fixes it.

I've also had problems with the watch variables crashing VS. I dealt with this by deleting the *.sou file which sometimes gets corrupted. You could try this if all else fails.

0 Kudos
Reply