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

查看:34
本文介绍了如何最好地调试 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?

推荐答案

如果你有预感这是一个过早的删除,让僵尸确认你的假设,然后调试正在发生的事情.当您启用僵尸时,对象并没有真正被销毁,而是设置为僵尸状态,这有助于您在调用 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天全站免登陆