调试时XCode调试与发布版本 [英] XCode debug vs release build when debugging

查看:122
本文介绍了调试时XCode调试与发布版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,我想我现在已经看到了。

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

大约24小时我一直试图调试我的应用程序,试图找到所有的奇怪的崩溃突然来了。我一直在通过模拟器/调试模式进行调试。像往常一样,当我遇到一个断点时,我可以看到变量的值(大部分时间)。然后突然我无法查看变量,无论我做了什么(顺便说一句,我正在谈论鼠标悬停,因为一些愚蠢的原因我的xcode从调试菜单中禁用了所有调试工具)。

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).

长话短说,由于完全失去了要做的事情,我决定使用发布模式进行调试。现在我可以点击断点并查看变量的内容。更令人困惑的是,现在xcode为我提供了一个更全面的视图,可以看到我正在观察(悬停)的变量。

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).

我知道Apple喜欢做不同的事情。但到底是什么!?有人可以打我,然后告诉我这里有什么不理解吗?

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?

推荐答案

首先,配置Debug和Release 只是名字,如果你愿意,你也可以将它们命名为Jon和Carla。它们只是您可以修改的配置集的名称,您可以调整它们,例如Debug配置不再适合调试。因此,如果您(意外)禁用在调试配置中生成调试符号,您将得到您所描述的内容。

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.

转到项目 - >编辑活动目标。选择Build选项卡,然后在左上角的下拉框中选择Debug配置。在下面的下拉框中选择显示所有设置,然后在这两个下拉框旁边的搜索栏中输入debug。

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.

应该有一个设置生成调试符号,确保设置了其复选框。 调试符号级别应设置为所有符号。此外,调试信息格式应设置为带有dSYM文件的DWARF。

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.

希望有所帮助。

这篇关于调试时XCode调试与发布版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆