H. William Welliver III wrote:
- Does optimization hurt the ability to debug?
Breakpoints on constant expressions or on a for loop, as examples, won???t get hit how you might expect them to. Is that okay, or should we explore ways to skip optimization at runtime?
I personally prefer that optimisation levels are decided at compile time only. Debugging an optimised version would imply that: - Yes, you cannot put breakpoints everywhere (some code has been optimised out), the debugger should pick the next nearest spot it *can* insert a breakpoint. - Yes, some variables are inaccessible because they have been optimised out. - Yes, single stepping can seem somewhat chaotic, because of code reordering.
But that is what I want, because otherwise I cannot debug optimised programs. Sometimes bugs only show up in optimised code. Being able to debug that without altering the runtime behaviour (timingwise or registerwise), would be essential.