Are there any tools to debug on linux + android?

I’ve got a strange error that brakes my game. And I spent two day trying to found out the reason of it. Here is code that generates error. The main reason why I can not figure out myself is that it game can breaks or at first circle, or at second, or work for 5 minutes without errors.

I tried to catch error using eclipse + logcat. But there were no errors.

Appreciate any help

void MainScene::startGame()
{
    this->block = BlockObject::create(48);
    this->block->setPosition(200, 300);
    this->block_exists = true;
    
    this->schedule(schedule_selector(MainScene::autoMoveBlockDown),0.2);
}

void MainScene::autoMoveBlockDown(float dt)
{
    if(this->block_exists)
    {
        this->removeChild(this->block);
        this->block_exists = false;
    }
    else
    {
        this->block = BlockObject::create(48);
        this->block->setPosition(200, 300);
        this->addChild(this->block, 20, TAG::BLOCK);
        this->block_exists = true;
    }
}

You might be using a lot of this-> where it is simply unnecessary…

To debug on Android, one option is to use ndk-gdb to get a stacktrace (and probably a lot more, but I don’t know that much). There are other options, but neither is a really great one, as far as I know. Debugging C++ on Android simply isn’t the best option.

Cocos2d-x runs on Linux (and other desktop OS) specifically to debug. You might want to debug that way, and then test on Android.

As for your problem, it actually seem very straightforward according the code you posted: this->block is never retained in startGame (either manually or by adding it to another Node or to a data structure).