What is the primary difference between Debug and Release build?

I'm coming from the world of VS, where there's a clear distinction between a Release and Debug builds. In Xcode I can't seem to see how two are different and how would I benefit from, say, a Debug build. Can someone explain this for me?

MacBook Pro 17", 2.66 GHz i7, 4GB 1067 DDR3 RAM, OS X 10.6.4 /// iPhone 4, 32GB, iOS 4

Posted on Dec 15, 2010 3:13 PM

Reply
5 replies

Dec 15, 2010 5:00 PM in response to Den B.

The differences between the Xcode debug and release builds are similar to the differences you'll find on any other system, though the Xcode interface might not present them as obviously. Basically, a debug build preserves all kinds of information that was developed during compilation but is no longer necessary at runtime. The presence or absence of this information (e.g. symbol tables and mappings which provide the original name of each source code variable and the source code line number corresponding to each instruction), becomes increasingly obvious as you use gdb and other debugging tools.

We normally would never want to release a debug version (in the iOS case, of course, it would never be accepted) because the binary is usually much larger and the performance will probably be compromised as well. For example, a typical debug build will have many perfomance optimizations turned off because these can make debugging more difficult. It's also common to enable "assert" statements in a debug version. These will bring the program down rather than giving the user any options or attempting recovery.

For more info specific to Xcode, see [Build Configurations|http://developer.apple.com/library/ios/documentation/DeveloperTo ols/Conceptual/XcodeBuildSystem/400-Build Configurations/build_configs.html#//appleref/doc/uid/TP40002692-SW7] in the +Xcode Build System Guide+. To get into lower level details, refer to the gcc docs, maybe starting with [3.9 Options for Debugging Your Program or GCC|http://gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html]. You might also want to take a look at your Target Build Options for the Debug configuration (Project->Set Active SDK->Use Base SDK and Project->Edit Active Target->Build). There's a one-to-one mapping between many of these settings and the gcc options.

\- Ray

p.s.: Didn't mean to repeat Xnav's points. As usual, I was still editing long after he posted! To clarify one difference: Selecting the Edit Active Target menu item gets you to the same place as double clicking on the icon for the active target in the Targets group of the Groups & Files tree. - R

Message was edited by: RayNewbie

Dec 15, 2010 4:57 PM in response to Den B.

Den B. wrote:
I'm coming from the world of VS, where there's a clear distinction between a Release and Debug builds. In Xcode I can't seem to see how two are different and how would I benefit from, say, a Debug build. Can someone explain this for me?


The distinction between Release and Debug in Xcode is virtually identical to what it is in Visual Studio.

You benefit from a debug build by being able to run your code in a debugger.

Dec 15, 2010 5:19 PM in response to etresoft

Thank you all. Yes, it seems like Xcode does not expose all that debugging stuff as much as VS does, but on the inside it's all the same.

A note for RayNewbie, though. Is GCC compiler still used in v.3.2.5? I thought they went with LLVM.

I also asked this in another thread. If there's such a big distinction between the Debug and Release builds, how come I can't seem to find preprocessor directives to distinguish between the two?

Dec 15, 2010 5:26 PM in response to Den B.

Den B. wrote:
Is GCC compiler still used in v.3.2.5? I thought they went with LLVM.


They are in transition. gcc is still the default for now.

I also asked this in another thread. If there's such a big distinction between the Debug and Release builds, how come I can't seem to find preprocessor directives to distinguish between the two?


You have to define your own.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

What is the primary difference between Debug and Release build?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.