Search code examples
ceclipse-cdtrelease-modedebug-mode

Eclipse CDT and Debug/Release Modes


I just got a simple "Hello, World!" C program to build and compile in the Eclipse CDT plugin. When you go to create a new C project, or when you go to set up a Run Configuration for an existing C project, Eclipse gives you the ability to specify either a Debug or Release Mode.

I am wondering what the difference is betwee these two modes. Obviously, Debug Mode is some kind of development mode that might not optimize things and take longer to build/run. But being new to C it's tough for me to actually understand what sort of configurations/param are Debug vs Release. Shockingly, the CDT documentation does not make any mention of Debug vs Release Mode whatsoever!

Can someone give me a concrete use case of something that might be a Debug Mode configuration, but not included in Release Mode? And, vice versa, something that would be included in Release Mode, but excluded in Debug Mode?


Solution

  • Generally, the additional flag -g is passed to gcc in debug build. It tells gcc to inlude debug info to the program. It's not possible to debug programs built without this flag.

    Another debug flag is -O0, which disables optimization. When you step through an optimized program, it will often jump to unexpected line of code, which makes it harder to debug.