Funky source code stepping in debug mode
I know about optimizers and I've been debugging MCUs for many decades. But this behavior is just too weird and difficult to deal with...
I'm using Atollic TrueSTUDIO 9.3.0. When I debug my code and single step through the C source code, the highlighted green line (aka "green cursor") steps in all kinds of crazy order. Consider a block of assignment statements followed by a function call, and then another block and call. The green cursor jumps around in random order through the block of assignments, and then finally gets to the function call. Then I can step over or into/out of the function and go to the next block of assignment statements. However, it's not that clear cut. The green cursor will be on the function call, and I'll click the toolbar button to step into the function. Instead of stepping into the function, the green cursor jumps back to an earlier assignment statement. The some of the assignment statement appear to get executed multiple times, and the green cursor is on the function call multiple times, before the step into actually steps into the function.
All this makes it very difficult to debug things. I can't be sure of what's going on. The green cursor even goes through BOTH clauses of an if/else structure, LOL.
Is there a way to prevent this crazy behavior?
Thanks!