XCode 4 断点未在正确的行处中断

发布于 2024-10-27 15:49:16 字数 733 浏览 4 评论 0原文

我的断点在最新的 XCode 4 版本中已停止正常工作。在不更改项目设置的情况下,断点不再在它们设置的行处中断。

例如,在一个函数中,我可以在其主体内的任何位置设置断点,但代码始终会在函数的最后一行中断。

在另一种情况下,我可以在一个函数中的任何位置设置断点,并且代码将在同一文件中不同函数中间的一行处中断!中断后的跟踪表明它确实在错误的位置中断,并且这不仅仅是文件/调试器同步问题。

我不知道为什么会这样。然而,它似乎确实从新的断点开始,而旧的断点起作用。任何新断点我都会在错误的位置添加断点。最近,有些文件甚至根本不会损坏!我只能假设断点是错误的,它被移动到未被调用的代码中。我已经针对这个问题进行了大量的互联网搜索和论坛搜索,尽管我发现有人有类似的问题,但要么没有解决方案,要么列出的解决方案(重新启动设备、交换调试输出、关闭优化等)不起作用为我。

值得一提的是,我主要使用 .mm 文件在 C++ 中进行编码。过去一年的 XCode 3 开发以及过去几个月的 XCode 4 一切都很好!我已经正确设置了调试。调试运行没有优化,没有死代码剥离,我使用 LLVM 编译器 2.0 和 DWARD 以及 dSYM 调试文件。然而,改变这些值并没有什么区别。

请帮忙,这让我发疯了!

对此的更新。在安装了新的 Lion 和 xcode 的全新机器上又开始发生这种情况。整个编辑器都乱了。下面的示例显示了错误行上出现的错误。

错误行错误!

My breakpoints have stopped working properly in the latest XCode 4 release. With no change to the project settings, the breakpoints no longer break at the line they are set.

For instance, in one function I can set a breakpoint anywhere within it's body, but the code will always break at the last line of the function.

In another instance, I can set a breakpoint anywhere in one function and the code will break at a line in the middle of a different function in the same file! Tracing through after the break shows that it did break in the wrong place and it's not just a file / debugger sync issue.

I have no idea why this has started. It did however seem to start on new breakpoints while old ones worked. Any new breakpoints I add break in the wrong place. And recently, some files now don't even break at all! I can only assume the breakpoint is so wrong it's moved into code that's not called. I have done numerous internet searches and forum searches for this problem, and although I have found people with similar issues, there was either no solution or the solution listed (rebooting device, swapping debug output, turning off optimization etc.) haven't worked for me.

It is worth mentioninig I'm mostly coding in C++ using .mm files. For the past year of development in XCode 3, and for the last few months in XCode 4 things have been fine! I have debug set up correctly. No optimization on a debug run, no dead code stripping and I'm using the LLVM compiler 2.0 with DWARD with dSYM debug file. However, changing these values makes no difference.

Please help, it's driving me mad!!

An update to this. It's started happening again on a brand new machine with a fresh Lion and xcode install. The whole editor is out of whack. Example below of the errors appearing on the wrong lines.

Errors on the wrong lines!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

2024-11-03 15:49:17

根据我所读到的内容,Xcode 往往会与断点混淆,而摆脱不同步问题的方法是清理“派生数据”;到目前为止,我发现了两种清理方法(说明对 Xcode 4.x 有效):

a) 进入管理器,在“项目”下,选择您的项目,然后在“派生数据”上点击删除

,或者

b) 进入产品菜单,按住键盘上的 ALT 按钮,观察菜单正在变化...因此 clean 转换为“Clean Build Folder...”

From what I've read all around, Xcode tend to get confused with breakpoints and the way to get rid of the out-of-sync problem is to clean the "Derived Data"; two ways of cleaning it so far I've found (instructions are valid for Xcode 4.x) :

a) go in the organiser, under the Projects, choose your project and hit that delete on the Derived Data

or

b) go in the Product menu, hold the ALT button on the keyboard and observe that the menu are changing... so the clean transform to "Clean Build Folder..."

我乃一代侩神 2024-11-03 15:49:17

在项目目标下的“构建设置”中,将“调试”的“优化级别”更改为“无”。

我发现这解决了我的问题。

With-in "Build Settings" under the project target change the "Optimization Level" for "Debug" to "None".

I found that this fixed the issue for me.

望笑 2024-11-03 15:49:17

我已经解决了这个问题,尽管我还没有找到根本原因。

我从项目中删除了无法使用断点的文件的引用。然后我进行了彻底的清理并进入文件夹并删除了所有构建和临时数据。然后我打开项目包并删除除项目文件本身之外的所有数据。然后我进行编译,因此由于缺少文件而引发错误。然后我将文件放回项目中。

现在,完全相同的文件可以在断点下正常工作!

不知道为什么,但很高兴它被修复了。

I have fixed this, although I haven't found the root cause.

I removed the references from the project for the files that were not working with breakpoints. I then did a full clean and went into the folders and deleted any build and temporary data. I then opened the project bundle and deleted all data except for the project file itself. I then compiled so it threw up errors due to the missing files. I then put the files back in the project.

Now, the exact same files work fine with breakpoints!

No idea why but happy it's fixed.

清风无影 2024-11-03 15:49:17

你清理你的目标了吗? Shift-Cmd-K。

Have you cleaned your targets? Shift-Cmd-K.

海螺姑娘 2024-11-03 15:49:17

在我升级到 XCode 4 后,这种情况开始发生在我身上。我刚刚删除了所有断点,进行了清理,然后重新添加了我的断点。现在似乎工作正常。

This started happening to me after I upgraded to XCode 4. I just deleted all breakpoints, did a clean, then re-added my breakpoints. Seems to work OK now.

尾戒 2024-11-03 15:49:17

我现在已经明白为什么会发生这种情况了。正如其中一个答复中提到的,您可以通过删除派生数据来修复它。这总能解决问题。由于某种原因,编辑器丢失了源代码和用于交叉引用断点和错误等的代码标记之间的关系。删除派生数据会强制它重新创建它。

我相信这只发生在使用 C 或 C++ 代码的文件中。苹果似乎忽视了 iOS 上的 C++ 开发者。我认识很多专业的游戏开发人员,每个人都使用 C++ 来编写游戏。苹果缺乏支持是令人恼火的。

I have figured out why this happens now. As mentioned in one of the replies you can fix it by deleting the derived data. This will always fix the problem. The editor for some reason loses it's relationship between the source code and the markup of the code it uses to cross reference breakpoints and errors etc. Deleting the derived data forces it to recreate this.

I believe that this only happens with files using C or C++ code. Apple seem to ignore C++ developers on iOS. I know a lot of professional game developers and every single one uses C++ to write games. Apple's lack of support is annoying.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文