strange GDB error unable to trace

帅比萌擦擦* 提交于 2019-11-29 15:23:01

You can try the following in order to see where the faulty CALayer was allocated:

(gdb) info malloc 0x911c2a0

I don't know if gdb plays well with zombie objects, but obviously, it seems that it has some limitations.

You have a memory management bug, obviously.

And you aren't tracing the exact line at all. To get a stack trace, type bt, or just look into the Debugger window (Run → Debugger).

(po means "Print Objective-C object". Since that particular instance has been deallocated, po-ing will cause further error.)

Try debugging with NSZombieEnabled set to YES executable environment:

To activate the NSZombieEnabled facility in your application:

Choose Project > Edit Active Executable to open the executable Info window. Click Arguments. Click the add (+) button in the “Variables to be set in the environment” section. Enter NSZombieEnabled in the Name column and YES in the Value column. Make sure that the checkmark for the NSZombieEnabled entry is selected.

You also might want to add a couple of breakpoints to help you debug them:

fb -[_NSZombie init]
fb -[_NSZombie retainCount]
fb -[_NSZombie retain]
fb -[_NSZombie release]
fb -[_NSZombie autorelease]
fb -[_NSZombie methodSignatureForSelector:]
fb -[_NSZombie respondsToSelector:]
fb -[_NSZombie forwardInvocation:]
fb -[_NSZombie class]
fb -[_NSZombie dealloc]

I've got the solution to the problem. The problem was due to a view Controller. The view controller was released and then after the method was called. But strange gdb didn't show anything about viewController relese....Neither turning on NSZombie helped.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!