views:

195

answers:

4

Hello all, 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 instance 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) 
A: 
KennyTM
A: 

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]
stigi
i have already added NSZombieEnabled in environment variables and set it to YES. Where do i add these breakpoints? fb -[_NSZombie init]fb -[_NSZombie retainCount]
Rahul Vyas
Those are future breakpoints (breakpoints of code thats not yet loaded). You can add them to ~/.gdbinit. See http://nslog.de/posts/46 for a list of all the stuff I'd recommend putting in there.
stigi
A: 

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.

Laurent Etiemble
A: 

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.

Rahul Vyas