我正在使用XCode 4.3.1,并且在过去几天调试我的应用程序时发生了一些奇怪的事情。
以下是代码:
-(void) init
{
list = [[NSMutableArray alloc]init]; // list is declared in the header
}
-(void) dosomething
{
[self init];
// strangely the debugger shows "list" is still null here
[list addObject: something];
// but it happily steps over the above line without adding anything to the list
}
另一个问题(代码中的其他地方)是有时调试器决定跳转几行(好像它切换到另一个线程,但只有一个线程)
最糟糕的部分是,当我跨过代码时,它甚至会向后退几行,然后再向前。
我试图切换到GDB,但无济于事。有人遇到过这些问题吗?
顺便说一下,我正在做一些分析,以便在这些事情开始发生之前找到内存泄漏
答案 0 :(得分:0)
问题是您正在使用编译优化来运行项目,可能是因为您在发布模式下调试它;或者由于某些原因,您在调试模式下的项目设置中定义了一些编译优化。检查您的XCode控制台中是否有此消息:
[Project Name] was compiled with optimization - stepping may behave oddly; variables may not be available.