Sign in to follow this  
CDProp

What is the difference between a debug build and a release build w/ debugging info?

Recommended Posts

CDProp    1451
I ran out of room in the title: I'm using C++ and VS2008. I figured that a release build that generated debugging info and had optimizations disabled was RINO (release in name only, lol). Someone told me that this is not necessarily the case, but they couldn't give me specifics about the difference. Does anyone have any detailed information on this? Right now, I have an unhandled exception (access violation), but it only happens in release mode. To complicate things, it happens inside a method that is defined in an external DLL that my program uses. I (partly) wrote the DLL, so I have access to the source code, but that doesn't help me much, because without debug info, Visual Studio will not allow me to step into any of the DLL's methods -- not even to see the disassembly. I tried following my friend's advice, and I built the DLL in release mode, albeit with debug information enabled, and now I can't get the error to repeat. So, if anyone has any information on how I can debug this, that would be great. I've looked over the code a thousand times, looking for the usual suspects, and I'm just not seeing where the error could be. Anyway, I suspect that I can't reproduce this error unless optimizations are enabled. But if optimizations are enabled, I can't enable debugging info, and if I can't have debugging info, then I can't get Visual Studio to show me where this exception is occuring.

Share this post


Link to post
Share on other sites
CDProp    1451
Oh dude. I guess I can combine optimization with /Zi (program database, no edit & continue). I will give that a try, and just hope that it crashes and that I get useful info from it.

Share this post


Link to post
Share on other sites
Sneftel    1788
Optimizations are the main difference between a debug and a release build. Debug information isn't a major functional difference, because modern practice is to put the debug information in a separate file anyway.

There's no hard and fast method for getting a bug in release mode to be reproducible in debug mode. It's just too wide a class of problems, one which includes things that just happened to occur in release mode instead of debug mode but could just as easily have occurred in debug mode instead of release mode.

In any case, you can certainly generate debugging information even with optimizations enabled. You will get semi-reliable stack traces, particularly if function inlining is disabled. You will NOT, however, be able to reliably step through the code with your debugger or examine data in the debugger. Debugging optimized code comes down to debugging the assembly.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this