Strange XCode debugger behaviour

I am using XCode 4.3.1 and something strange is happening when I debug my app in last few days.

Here is the code:

-(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
}

Another problem (somewhere else in the code) is that sometimes the debugger decides to jump several lines (as if it switches over to another thread but there's only one thread)

The worst part is sometimes when I step over the code it even goes backward a few lines and and then forward again.

I tried to switch to GDB but to no avail. Has anyone run into these problems?

Btw, i was doing some profiling to find memory leaks before these things start happening


The problem is that you are running your project with compiling optimizations, probably because you debug it in release mode ; or because for some reasons you have some compiling optimizations defined in your project settings in debug mode. Check if you have the message hereafter in your XCode console :

[Project Name] was compiled with optimization - stepping may behave oddly; variables may not be available.

If yes, read this : 'Project Name' was compiled with optimization - stepping may behave oddly; variables may not be available

链接地址: http://www.djcxy.com/p/68674.html

上一篇: XCode 4.6断点不起作用

下一篇: 奇怪的XCode调试器行为