2

What is difference in debugging in debug mode and release mode? In release mode the symbols table that is loaded contains less information of symbols which means less debugging information. But, if we set "Disabled (/Od)" in C/C++->Optimization->Optimization then I could not see any difference in two debugging type. Is there any difference in debug mode and release mode(with Optimization Disabled)?

1 Answer 1

3

There's very little magic to it. Debug and Release are simply names assigned to a set of compiler options. The most relevant option for the Debug configuration is the /Od option, it disables the optimizer so your code is easier to debug.

Clearly you can always change the Release configuration options to resemble the Debug configuration options. Like disabling the optimizer. Now there's no relevant difference anymore between them and the Release configuration behaves a lot like the Debug configuration in the debugger.

Other options normally used in the Debug configuration that affects your code:

  • the _DEBUG macro is defined, asserts will fire
  • function inlining is turned off
  • the /RTC option is turned on, very good at catching bugs in your code
  • the _HAS_ITERATOR_DEBUGGING macro is defined, catching bugs in code that uses STL classes
  • you'll link with the debug build of the CRT, enabling asserts in that build
  • the debug allocator will be enabled, assuming you #included crtdbg.h
  • edit + continue support is turned on, a side effect is much bigger stack frames
Sign up to request clarification or add additional context in comments.

2 Comments

Then does that mean release mode without optimization is literally equal to debug mode? If yes then why do dll fails to load when we load dlls in debug mode? or vice versa..
Not "literally", I listed the other options that are normally different in the Debug configuration. /Od is by far the most important difference, the optimizer makes debugging quite difficult. You haven't mention "fails to load" before, mixing multiple versions of the CRT in a single program is normally quite troublesome. 5th bullet in the list, you want to avoid having both the debug and release version of the CRT. Easy to avoid as long as you keep both the DLL and EXE projects in the same solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.