Originally posted by: Omar
Hi,
i tried to debug the release version of my program last week. I was getting a weird error in release but not in debug version. The case is that I changed project configuration to, keeping realease mode, be able to debug... But I woulnd't be able to catch the error. I set everything as at first and compiled again... and the error was still there! Does anyone know what could has been the problem?
Originally posted by: Vitaly Meytin
for example,
// turn optimization off
void SomeFunction ()
// restore optimization to original state as defined in
If you have some misterious crash in optimized code you
don't have to recompile the entire project without optimization. You may try to isolate suspected parts
of the code using
#pragma optimize ("optimization list", {on, off})
#pragma optimize ("", off)
{
....
}
// project settings
#pragma optimize ("", on)
Originally posted by: Russell Elledge
Here's a trick that's helped me narrow down many a release mode only bug.
A good way to get an idea of whats happening when this happens is:
Under your "Release" build settings, set the debug output to "Line Numbers Only." This will make it so you can place breakpoints in your application without adding back in a bunch of assertion and debug code that can make problems _seem_ to go away.
...no, you won't be able to look at variables. But it's a whole lot better than narrowing this kind of problem down with only MessageBox calls. If you need to look at a variable that badly, add the symbol 'eax' to your watch window. Return values from functions that will fit in 32 bits are (almost) always stored in the processor EAX register.
Good Luck to Us All,
Russell Elledge
Can You Imagine Software, Inc.
http://www.canyouimagine.com
Originally posted by: Gautam Sarup
If you enable debug info and disable optimizations don't you end up with a debug build that's just called a release build? :-)
Reply
Originally posted by: Marijn Eken
I tried your little trick, when I had some problems with a release version that wouldn't work, while the
debug version did.
At one point I thought I had found the bug. When a particular command executed, some things in memory
changed which should not change. Well, it turned out, after long searching, that EVERY command I stepped
(F10) through did this. Hmmm, strange...
Some more trial and error learned me that the changes in memory were ACTUALLY not occuring, the debugger
only said so! Thus, I'm wondering if this little release debug trick really CAN work??
PS. You said: "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. "
I did that and then it worked, but what's the REAL solution here? Just, disabling the optimizations for an unknown reason, doesn't do it for me..
Reply