Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CMake build mode RelWithDebInfo

I think that I understand the difference between Release and Debug build modes. The main differences being that in Debug mode, the executable produced isn't optimized (as this could make debugging harder) and the debug symbols are included.

While building PCRE, one of the external dependencies for WinMerge, I noticed a build mode that I hadn't seen before: RelWithDebInfo.

The difference between Debug and RelWithDebInfo is mentioned here: http://www.cmake.org/pipermail/cmake/2001-October/002479.html. exerpt: "RelwithDebInfo is quite similar to Release mode. It produces fully optimized code, but also builds the program database, and inserts debug line information to give a debugger a good chance at guessing where in the code you are at any time."

This sounds like a really good idea, however not necessarily obvious how to set up. This link describes how to enable this for VC++: http://www.cygnus-software.com/papers/release_debugging.html

Am I missing something, or does it not make sense to compile all release code as RelWithDebInfo?

like image 302
sideproject Avatar asked Aug 06 '09 15:08

sideproject


People also ask

What is RelWithDebInfo?

exerpt: "RelwithDebInfo is quite similar to Release mode. It produces fully optimized code, but also builds the program database, and inserts debug line information to give a debugger a good chance at guessing where in the code you are at any time."

What does Dcmake_build_type release do?

It enables certain compiler options defined in the core CMake modules, which are specific to the target system.

What is the default build type in CMake?

In this answer, it says Debug is the default cmake build configuration.

What is Cmake_build_type?

Specifies the build type on single-configuration generators (e.g. Makefile Generators or Ninja ). Typical values include Debug , Release , RelWithDebInfo and MinSizeRel , but custom build types can also be defined.


1 Answers

As far as I'm concerned, shipping code to customers without having corresponding debug symbols stored in-house is a recipe for hair-loss when it comes to debugging production problems.

Debugging Release builds with debug symbols is rarely any different from debugging Debug builds, so I'd recommend always doing this.

That said, I don't know if there are any drawbacks. It'd be interesting to hear, if so.

like image 88
Kim Gräsman Avatar answered Sep 22 '22 13:09

Kim Gräsman