2010-05-26 123 views
3

我在gdb中遇到这个奇怪的错误,我无法追踪确切的代码行来追踪错误。有人知道这种类型的错误吗?这是我在gdb中得到的东西奇怪的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) 

回答

0

我已经解决了这个问题。问题是由于视图控制器。视图控制器被释放,然后在调用方法之后。但奇怪的gdb没有显示任何关于viewController relese ....都没有打开NSZombie帮助。

0

显然你有内存管理错误。

而且你根本没有追踪确切的路线。要获取堆栈跟踪,请输入bt,或者查看Debugger窗口(运行→ Debugger)。

po手段 “打印目标C对象” 自该特定实例已释放,po -ing将导致进一步的错误。)

0

尝试调试与NSZombieEnabled设置为YES的可执行环境:

要激活您的应用程序的NSZombieEnabled 设施:

选择Project>编辑Active 可执行文件打开可执行文件信息 窗口。点击参数。单击“在环境中设置变量 ”部分中的添加 (+)按钮。在名称列中输入 NSZombieEnabled,在值列中输入 。确保 已选中 NSZombieEnabled条目的复选标记。

您可能还需要添加一些断点来帮助调试他们:

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] 
+0

我已经在环境变量中添加了NSZombieEnabled并将其设置为YES。我在哪里添加这些断点? fb - [_ NSZombie init] fb - [_ NSZombie retainCount] – 2010-05-26 08:36:36

+0

这些是未来的断点(尚未加载的代码的断点)。您可以将它们添加到〜/ .gdbinit。请参阅http://nslog.de/posts/46以获取我建议放在那里的所有内容的列表。 – stigi 2010-05-26 19:22:50

2

你可以尝试以下才能看到有故障的CALayer的被分配:

(gdb) info malloc 0x911c2a0 

我不知道gdb是否适合僵尸对象,但很明显,它似乎有一些限制。

+0

有用的信息!谢谢 – windson 2011-09-22 23:28:31