Forum Discussion
Altera_Forum
Honored Contributor
11 years agoOptimized object code no longer aligns with lines of source code. The debug symbol values and source code line numbers represent a guess by GCC and are often not helpful. You should make sure that the code you want to single step, step return, etc is compiled without optimization. Of course this will change the order things are executed in and may change the behavior of the code. In optimized code you can sometimes single step instruction by instruction to follow what is going on.
The compiler will also place variables in registers. This can cause the debugger to loose track. Sometimes you can look at the object code and figure out which register the variable is in. At other times, the variable will be optimized completely away and it is nowhere to be found. Welcome to software...