Three must-set options for VS2010 debugging with Release

How to: Debug a Release Build

You can debug a release build of an application.

To debug a release build

  1. Open the Property Pages dialog box for the project. For details, see Working with Project Properties.

  2. Click the C/C++ node. Set Debug Information Format to C7 compatible (/Z7) or Program Database (/Zi).

  3. Expand Linker and click the General node. Set Enable Incremental Linking to No (/INCREMENTAL:NO).

  4. Select the Debugging node. Set Generate Debug Info to Yes (/DEBUG).

  5. Select the Optimization node. Set References to /OPT:REF and Enable COMDAT Folding to /OPT:ICF.

  6. 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 /RTC to try to expose such bugs in your debug builds.

    For more information, see Optimizing Your Code.

===============

 

Set the method to debug in Release mode:
1. Right click on the project -> Properties
2.c++ -> General -> Debug Information Format Select Program Database (/Zi) or (/ZI), Note: If it is a library, only (Zi)
3.c++ -> optimization -> optimization selection prohibited (/Od)
4. Connector->Debug->Generate debugging information Yes (/DEBUG) 



https://blog.csdn.net/haizimin/article/details/50262901

In some cases, we may not be able to directly use Debug mode to debug programs, so how to debug programs in Release mode?

1. Set the project properties to Release, generate ---> Configuration Manager:

 

2. Press Alt+F7 to pop up the property page to set:




Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324917414&siteId=291194637