How should you disable all types of optimizations while debugging in VS2010?
Select the menu item Project->Properties.
Project->Properties
Under Configuration Properties->C/C++->Optimization, in the Optimization field, select disabled.
Configuration Properties->C/C++->Optimization
Optimization
disabled