How to: Debug a Release Build
You can debug a release build of an application.
To debug a release build
-
Open the Property Pages dialog box for the project. For details, see .
-
Click the C/C++ node. Set Debug Information Format to or Program Database (/Zi).
-
Expand Linker and click the General node. Set Enable Incremental Linking to .
-
Select the Debugging node. Set Generate Debug Info to .
-
Select the Optimization node. Set References to and Enable COMDAT Folding to .
-
You can now debug your release build application. To find a problem, step through the code (or use Just-In-Time debugging) until you find where the failure occurs, and then determine the incorrect parameters or code.
If an application works in a debug build, but fails in a release build, one of the compiler optimizations may be exposing a defect in the source code. To isolate the problem, disable selected optimizations for each source code file until you locate the file and the optimization that is causing the problem. (To expedite the process, you can divide the files into two groups, disable optimization on one group, and when you find a problem in a group, continue dividing until you isolate the problem file.)
You can use to try to expose such bugs in your debug builds.
For more information, see .
===============
在有的情况下,我们可能不能直接利用Debug模式进行程序调试,那么如何在Release模式下进行程序调试呢?
一、将项目属性设置为Release,生成--->配置管理器:
二、按Alt+F7,弹出属性页进行设置: