Microsoft

Debugging Optimized Code

Aug 14, 2015Andrew B Hall - MSFT
Debugging Optimized Code
SummaryAI, from the source post

This post details how to debug optimized code, which is challenging due to compiler optimizations like dead code elimination, loop optimizations, and inline expansion. It explains that variable inspection and breakpoint hitting can be unreliable. For C++, the /Zo flag and selective de-optimization using #pragma optimize("",off) are suggested. For .NET, the "Suppress JIT optimizations on module load" option in Visual Studio is discussed, along with its implications. The post also recommends using the Disassembly window to step through actual machine code when debugging optimized builds.

More from the NGEN PDB Generation for Profiling trail