I am getting this strange error in gdb and i'm unable to trace the exact line of code to trace the bug. Does someone knows about this type of bug? Here is what i get in gdb
*** -[CALayer sublayers]: message sent to deallocated instan开发者_JAVA技巧ce 0x911c2a0
(gdb) po 0x911c2a0
Program received signal SIGTRAP, Trace/breakpoint trap.
0x020993a7 in ___forwarding___ ()
The program being debugged was signaled while in a function called from GDB.
GDB has restored the context to what it was before the call.
To change this behavior use "set unwindonsignal off"
Evaluation of the expression containing the function (_NSPrintForDebugger) will be abandoned.
(gdb) info symbol 0x911c2a0
No symbol matches 0x911c2a0.
(gdb)
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.
精彩评论