ios 在 Xcode 4 中设置 malloc_error_break
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6969407/
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
Set malloc_error_break in Xcode 4
提问by Manish Burman
How do I set a malloc_error_break in Xcode4? Also, I seem to be getting this error malloc: *** error for object 0x4d80814: incorrect checksum for freed object - object was probably modified after being freed.
如何在 Xcode4 中设置 malloc_error_break?另外,我似乎收到此错误malloc: *** error for object 0x4d80814: incorrect checksum for freed object - object was probably modified after being freed.
Is there anyway I can check what object 0x4d80814 is? It doesn't show up in the variables list in the debugger.
无论如何我可以检查什么对象 0x4d80814 是什么?它不会出现在调试器的变量列表中。
回答by Manish Burman
I think this is how its done.
我认为这就是它的完成方式。
- Click on the breakpoints navigator (looks like a sign post) on the top of the left bar on XCode 4.
- On the bottom left hand corner there is a plus sign. Click on it.
- Add Symbolic Breakpoint and set malloc_error_break as the symbol.
- Click the next breakpoint button ( it looks like |> ) and is on the bottom panel. It will take you to the line that is causing the error.
- 单击 XCode 4 左侧栏顶部的断点导航器(看起来像一个路标)。
- 在左下角有一个加号。点击它。
- 添加符号断点并将 malloc_error_break 设置为符号。
- 单击位于底部面板上的下一个断点按钮(看起来像 |> )。它将带您到导致错误的行。
Usually it is caused by objects being created as subobjects of other objects that don't exist yet (ie SKPhysicsBody being created before its spritenode exists)
通常是由于对象被创建为尚不存在的其他对象的子对象(即 SKPhysicsBody 在其 spritenode 存在之前被创建)
回答by Fran Sevillano
This is what the breakpoints button looks like:
这是断点按钮的样子:
And this is the plus sign at the bottom left hand corner:
这是左下角的加号:
Man, it took me a while to find both of them!
伙计,我花了一段时间才找到他们两个!
回答by manylegged
You can also do it directly through the gdb command window.
您也可以直接通过 gdb 命令窗口执行此操作。
break malloc_error_break
or in lldb:
或在 lldb 中:
breakpoint set -n malloc_error_break
To open the debugger command window in XCode 4, click the middle button above "View" in the top right corner, then click the middle button in the top right corner of the bottom debugging pane that just opened. See also Input to console in Xcode 4
要在 XCode 4 中打开调试器命令窗口,请单击右上角“查看”上方的中间按钮,然后单击刚刚打开的底部调试窗格右上角的中间按钮。另请参阅Xcode 4 中的控制台输入