How to Debug the Release Build?

16 11 2008


“Debugging in release build!!! Is it possible?” I’ve heard this questions a couple of time, especially from Visual C++ Novices. Yes! its possible. But why?
I still remember my first project. We did everything right, debugged and fixed all bugs in debug build and released the application. But client tested the release version and it was like FatMan, a lot of crashes.

So, Debugging in release build is important because, even though the debug build can catch most of issues, there might be some bugs or crashes still hiding under the release version of application. For catching them, there is now way other than to debug the release build itself.

debuginreleasebuild


Well, basically compiler needs debug information for stepping into code while debugging and In release build, by default there will not be any debug information. Compilers cannot interpret or understand optimized code and in release build, optimization will be enabled by default. For debugging in release build, you’ve to generate debug information and to turn off optimizations. Follow the steps about how to tweak project settings for that.

1) Take project settings by Alt+F7.
2) Select Release configuration.
3) Select “C/C++” tab. Set “Optimizations” as “Disable Debug” and “Debug Info” as “Program Database”.

debuginreleasebuild1

4) Take “Link” tab. Enable “Generate Debug Info“.

debuginreleasebuild2

5) Now from menu, take – “Build > Set active configuration…” and select Release build as default.

debuginreleasebuild3

6) Rebuild the project by F7.
7) Now what are you waiting for? Press F5 to debug and enjoy!


Since my first project, I don’t forget how to debug in release version. 😀 and this is my advice for you – “Its fine to do the entire debugging in debug build, because its tuned to catch a lot of bugs. But before releasing check the release build too.”


Targeted Audience – Beginners.

Advertisements

Actions

Information

5 responses

16 11 2008
jon

Are you still using VC++ 6.0?

16 11 2008
Jijo.Raj

Yes. dude. 🙂 I’m waiting for Visual Studio 10 which is the next 6. 🙂

Regards,
Jijo.

18 11 2008
biju

Nice tip dude..
🙂

18 11 2008
Jijo.Raj

Thanks dude. 😀

1 02 2009
kapi

is there a way so the default value in “set Active configuration” to be the release and NOT the debug version?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s




%d bloggers like this: