Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XCode debug vs release build when debugging

Ok, i think i've seen it all now.

For about 24 hours i've been trying to debug my app, trying to find where all the weird crashes are coming from all of a sudden. I've been debugging via Simulator/Debug mode. As usual, when i hit a breakpoint, i could see the value of variables (most of the time). Then suddenly i was unable to view variables no matter what i did (btw, im talking about mouse-hovering as for some stupid reason my xcode disabled all the debugging tools from the debug menu).

Long story short, out of sheer loss of things to do, i decide to debug with Release mode. Now I can hit breakpoints and see the contents of my variables. And whats even more confusing is that now xcode gives me a much more comprehensive view of the variables that im 'watching' (hovering over).

I know Apple likes to do things different. But what the heck!? Can somebody please slap me and then tell me what im not understanding here?

like image 296
AlvinfromDiaspar Avatar asked Sep 24 '10 06:09

AlvinfromDiaspar


People also ask

What is the difference between a debug build and a release build?

Major differences are the debug apk and the release apk: For debug builds the apk will be signed with the default debug signing keys with debug flag enabled. For release apk you will have to explicitly specify the apk to sign with and the debug flag will be turned off so that it cannot be debugged.

Is release build faster than debug?

Lots of your code could be completely removed or rewritten in Release mode. The resulting executable will most likely not match up with your written code. Because of this release mode will run faster than debug mode due to the optimizations.

What is difference between release and debug mode?

By default, Debug includes debug information in the compiled files (allowing easy debugging) while Release usually has optimizations enabled. As far as conditional compilation goes, they each define different symbols that can be checked in your program, but they are language-specific macros.

What is debug release Xcode?

Debug – Used for running the environment locally for testing by the development team if needed. Release – This is the configuration that will archive the application to be built locally or by CI.


1 Answers

First, the configurations "Debug" and "Release" are just names, you could also name them "Jon" and "Carla" if you want. They are just names for a configuration sets that you can modify and you can tweak them so that for example the "Debug" configuration is not suitable for debugging any more. So if you (accidentially) disabled generating debug symbols in your "Debug" configuration you would get exactly what you described.

Go to "Project" -> "Edit active target". Select the "Build" tab and select the "Debug" configuration in the drop down box on the upper left. Select "Show all settings" in the drop down box below and type "debug" in the search bar right next to these two drop down boxes.

There should be a setting "Generate Debug Symbols", make sure its check box is set. "Level of Debug Symbols" should be set to "All Symbols". Also, the "Debug Information Format" should be set to "DWARF with dSYM file".

After changing the settings, clean your project ("Build" -> "Clean") and build again.

Hope that helps.

like image 76
DarkDust Avatar answered Oct 11 '22 18:10

DarkDust