Hi,
I'm compiling an application with /Od and /Zi. When I omit the -DEBUG linker flag I get a crash in my application. When I add the -DEBUG flag it does not crash anymore.
Any idea how to debug this
Thanks,
Manu
Hi,
I'm compiling an application with /Od and /Zi. When I omit the -DEBUG linker flag I get a crash in my application. When I add the -DEBUG flag it does not crash anymore.
Any idea how to debug this
Thanks,
Manu
Debuggin issue
SONB
Hi,
Reproducible under the debugger, means that when launched from the VS IDE. It has been my experience that often bugs only show up when launched outside the IDE and not within. In my case, it was both.
Unfortunately no small code snippet.
-DEBUG means /DEBUG option of the linker. So it has nothing to do with the C generated code. The only difference is this linker option.
Regards,
Manu
MadBison
What do you mean with it is reproducable in the debugger
It would be interesting if you have a small code snippet to reproduce it and a copy of your compiler and linker flags.
With -DEBUG you mean the /DEBUG switch for the linker or the _DEBUG preprocessor definition
If it is the preprocessor definition you can run the files through the preprocessor and compare the outputs if you are interested in seeing what the differences are.
Quanta05
I would look through the source where it seems to crash. Maybe you have some idea where it crashes The message from the crash might give you an indication.
I would start looking for missed checks for valid pointers, initialisations in ASSERT() macros or other code that is run only in debug builds. This usually turns up as crashes in release builds while it works in debug build.
To find the crashing code it can help to comment out code that is suspect and do a release build to see if it still crashes.
If it still is difficult to find out where it crashes you might want to add some kind of tracing to a file.
JAMES NIGHTINGALE
I can't understand this because using /Zi all debug infos (except the filename of the pdb file is inside a seperate file. The produced binary code should be the same.
What happens is you even load the program into the debugger. Whats on the callstack
Alain Martineau
Hi,
That's what I thought too, but the behavior is definitely different and the only differences between the two binary is the -DEBUG flag in the linker.
The behavior is also reproducible in the debugger. I've used both Visual Studio and WinDbg to debug and when the program is linked without -DEBUG it crashes, and when linked with -DEBUG it does not crash.
Does the -DEBUG have an impact on the library used for the microsoft C++ runtime My feeling is that the addresses given by malloc might be different between the two modes which is the only explanation I can give to what it crashes when not compiled with -DEBUG.
Thanks for the help,
Manu