Cocos2d-x+xcode debugging show Pointer is NULL?+ is Xcode not good for Cocos2d-x or C++ debugging?

Cocos2d-x+xcode debugging show Pointer is NULL, but i test Pointer is not NULL??
is Xcode not good for Cocos2d-x or C++ debugging?

debugging Picture:

thank all
solve: That works. The build settings~~>Other C Flags~~>Debug has a option O2. I change it toO0 and it works.

I have the same problem. When using Coco2D-x the debugger is absolutely useless, it show NULL to a lot of things, which are not null. I got used to using CCLOG instead, but it makes development really slow. This problem is driving me crazy…

xcode 5.0.1
i have not find a good method, i use CCLOG or command “print variable” to debug. This problem is driving me crazy too

I have figured out that every variable becomes NULL automatically, if it is not going to be referred anymore in the current scope. I think this might be some kind of optimalisation, and I have no idea how it could be disabled. Debugging is a nightmare compared to Cocos2D-iPhone.

I have the same problem. You remind me may be we should try the build setting -O?
Adam Fischer wrote:

I have figured out that every variable becomes NULL automatically, if it is not going to be referred anymore in the current scope. I think this might be some kind of optimalisation, and I have no idea how it could be disabled. Debugging is a nightmare compared to Cocos2D-iPhone.

That works. The build settings->Other C Flags->Debug has a option -O2. I change it to -O0 and it works.

This has solved the problem! Thank you very much! :slight_smile:

You should be using CCAssert

You should also NOT be doing a cast like that in C*+ using a CCArray
Also adjusting your C*+ Exception behavior will help a lot.

Thanks, @Changjun Shuai. You saved my day! :slight_smile:

When i change flag, it’s crash:
error: memory read failed for 0x0