I have a project I tried cleaning and rebuilding but debug is skipping lines.
while (1) { 1 Delay(); //delay 200ms 2 CanWriteData(0xA544); 3 Delay(); //delay 200ms
}
I put a break point on 1,2 and 3. the break point 1 is skipped and the debug goes right to 2. If I step in it goes to the delay function not the CanWriteData and freezes. If I instead hit f5 it goes to 3, then back to 2,3,2,3,2, etc... on hitting 5f.
What can I do to get the debugger to know the code was changed?
Compile without optimization. The compiler doesn't have a one-to-one relationship between C lines and assembler code generated, code may spread over multiple lines, be re-ordered or removed. Use the disassembly view to place breakpoints, and review the generated code.
Dead code and pointless spin loops may also be removed. Use volatile keyword appropriately.