如何最好地调试objc_msgSend中的崩溃? [英] How best to debug a crash within objc_msgSend?

查看:213
本文介绍了如何最好地调试objc_msgSend中的崩溃?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

NSAutoreleasePool 下水时,我发生崩溃。可能池正在尝试释放已经由另一段代码过早释放的对象。崩溃我在 objc_msgSend 中尝试向不再存在的对象发送消息。

I have a crash taking place when an NSAutoreleasePool drains. Presumably the pool is trying to deallocate an object that has been prematurely released by another piece of code. The crash I have is in the midst of objc_msgSend as it is trying to send a message to an object that doesn't exist anymore.

给定堆栈状态,有什么提示/技巧/进程/ gdb 命令,我有我的处置,以获取有关的对象的信息和/或非法解除分配的发生点?

Given the stack state, what tips/tricks/processes/gdb commands do I have at my disposal to get information about the object in question and/or the point at which the illegitimate deallocation took place?

推荐答案

如果你有一个hunch,它是一个过早的删除,启用僵尸确认你的假设,然后调试发生了什么。当启用僵尸时,对象不会被真正销毁,而是设置为僵尸状态,这有助于您在调用dealloc之后检测它们何时被访问。阅读更多 NSZombieEnabled

If you have a hunch that it is a premature deletion, enable zombies to confirm your hypothesis and then debug what is going on. When you enable zombies, objects are not really destroyed, but set to a zombie state, which helps you to detect when they are accessed after they dealloc is called. Read more from NSZombieEnabled

这篇关于如何最好地调试objc_msgSend中的崩溃?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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