xcode 在导致 EXC_BAD_ACCESS 的断点处停止

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8296255/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 22:34:47  来源:igfitidea点击:

Stopping at breakpoints causing EXC_BAD_ACCESS

iosxcodedebuggingexc-bad-accessbreakpoints

提问by Dann

My app runs fine and as expected, but for some reason when I place breakpoints, stepping into/over/resuming causes the program to crash with EXC_BAD_ACCESS. This does not happen if I remove/disable breakpoints.

我的应用程序按预期运行正常,但由于某种原因,当我放置断点时,单步执行/结束/恢复会导致程序因 EXC_BAD_ACCESS 而崩溃。如果我删除/禁用断点,则不会发生这种情况。

Any advice?

有什么建议吗?

回答by gak

From what I can see, LLDB appears to be broken in the Xcode 4.2 and 4.2.1. Switch to GDB in your "Edit Scheme" settings.

据我所知,LLDB 在 Xcode 4.2 和 4.2.1 中似乎已损坏。在“编辑方案”设置中切换到 GDB。

Breakpoints work just as expected after switching to GDB.

切换到 GDB 后,断点按预期工作。

Edit Scheme Dialog

编辑方案对话框

回答by Andrew

To anyone that might experience the same thing with Xcode 5.0.1 and Mavericks: Try deleting all your schemes and auto create them again - that fixed it for me.

对于可能在 Xcode 5.0.1 和 Mavericks 中遇到相同问题的任何人:尝试删除所有方案并再次自动创建它们 - 为我修复了它。

回答by Mário Carvalho

This was a bug with XCode 5.0.1 and Mavericks. Apple released 5.0.2 and the bug is fixed!

这是 XCode 5.0.1 和 Mavericks 的一个错误。Apple 发布 5.0.2 并修复了错误!

回答by Hill

I am using the Xcode 4.3.2 and Xcode update the debug to LLDB automatically(A popup dialog and I confirm it). This is really a nightmare, it crash when I step into any function call 8-9 out of 10.

我正在使用 Xcode 4.3.2 并且 Xcode 自动将调试更新到 LLDB(一个弹出对话框,我确认了它)。这真的是一场噩梦,当我进入 10 个中的第 8-9 个函数调用时它会崩溃。

Change back to GDB seems better now!

现在改回 GDB 似乎更好了!

回答by Guillaume Laurent

Where you using lldb instead of gdb ? I'm getting this systematically with Xcode 4.2.1 and lldb. Switching back to gdb (booooo) solves the problem.

你在哪里使用 lldb 而不是 gdb ?我用 Xcode 4.2.1 和 lldb 系统地得到了这个。切换回 gdb (booooo) 解决了这个问题。

回答by Colin

For what it's worth, I'm having the same problem. I can take code that I know is correct and if I step into it with lldb, it crashes after reaching a breakpoint. I also get output like this when I try to print any locals

对于它的价值,我遇到了同样的问题。我可以使用我知道正确的代码,如果我使用 lldb 进入它,它会在到达断点后崩溃。当我尝试打印任何当地人时,我也会得到这样的输出

(lldb) p self
error: use of undeclared identifier 'self'
error: 1 errors parsing expression

Looks like lldb is busted in Xcode 4.2.1. The only advice I have is switch back to gdb for now.

看起来 lldb 在 Xcode 4.2.1 中被破坏了。我唯一的建议是暂时切换回 gdb。

回答by Alan Zeino

EXC_BAD_ACCESSmeans you have a memory problem somewhere - very likely that something is being released when you expect it to still be around (perhaps the result of an autorelease). Run the static analyzerto find it. I imagine you're seeing the crash because the debugger is aggressively occupying memory when you load breakpoints and hence flagging a problem somewhere else.

EXC_BAD_ACCESS意味着您在某处有内存问题 - 很可能是在您期望它仍然存在时正在释放某些东西(可能是 的结果autorelease)。运行静态分析器以找到它。我想您会看到崩溃,因为当您加载断点并因此在其他地方标记问题时,调试器正在大量占用内存。