Debugging the release version of a program
Posted
by Tom Moor
on August 6th, 1998
In MSVC you can set all of your project's configurations in the Project Settings dialog.
1.Select the All Configurations option in the Settings For combobox.
2.On the C/C++ tab, select Program Database in the Debug info combobox.
3.On the Link tab, with the Category combobox on Debug, check the Debug info checkbox and the Microsoft format.
If you use your own make file use /Zi switch with CL.EXE and use the use the /DEBUG and /PDB:
That's all there is, now you can set breakpoints and watch variables as usual. Be aware that due to the optimizer not all symbols can be watch and the execution of the line may be in a different order!
A common error that affects only the release version of a program is when you use ASSERT instead of VERIFY. Remember ASSERTs will compile to nothing in a release version but VERIFY does. So if you call a function like ASSERT(DoSomething()) this function will not be called in the release version!
A release version of a program can behave different than the debug version due to optimzier settings. If you find a strange/buggy behavoir disable every optimazion and try again.

Comments
How to Debug CPaint?
Posted by Legacy on 12/01/2003 12:00amOriginally posted by: V.Ravendra Kumar
Icons have been added against menu. Now I want to change the icons. How to debug the code regarding that.
ReplyHow to debug another exe from existing application.
Posted by Legacy on 01/02/2003 12:00amOriginally posted by: shashi
I have an application (vc++6.0), which calls another application (vc++ 6.0), which is on same machine. When i try to debug by putting break points in the called exe code, its not going into the code (called exe code). Can any one help me in this?
ReplyRegarding assert
Posted by Legacy on 12/04/2002 12:00amOriginally posted by: Low Chee Kong
Hi,
Like to find out whether there is a way to hide the assert message from showing up for testing purposes.
I try using catch exception. However, it still shows up.
Thanks!
Replya hi !
Posted by Legacy on 11/01/2002 12:00amOriginally posted by: kenhan
iwant to read your commet list and your news ! so you send to my E-Mail
Replythank you
debugging information not in precompiled heade
Posted by Legacy on 10/18/2002 12:00amOriginally posted by: Ralf Schneider
if I turn on the described switches, I get the warning C4650 and the error C2859. They told me, that the precompiled header has no debug information. Accordingly I have to do something else.
ReplyWhat do I have to do ????
This is one step ahead
Posted by Legacy on 09/03/2002 12:00amOriginally posted by: nilesh Yeolekar
Actually I was knowing how to get correct app runnig in release mode by disabling any optimization in the environment.But it seems to be one step ahead of what I was using uptill now.
ReplyThx very much.
Really a good article !!
Posted by Legacy on 08/10/2002 12:00amOriginally posted by: Dilip Dave
Reply"...debugging relase versions in MSVC..."
Posted by Legacy on 03/21/2002 12:00amOriginally posted by: Henry Park
Replyglobal variables
Posted by Legacy on 01/30/2002 12:00amOriginally posted by: Patrick Vankeirsbilck
Replyeven worse things can happen
Posted by Legacy on 12/08/2001 12:00amOriginally posted by: Milan Stezka
I've found that program behaving differently when built with release cofig is not the worst case. I've even ended up with program acting right when executed from the VC6 IDE and acting wrong when executed simply from Windows.
ReplyLoading, Please Wait ...