Tuesday, 15 February 2011

c++ - Cocos2d-x Android project random crash libc fatal signal 11 error? -



c++ - Cocos2d-x Android project random crash libc fatal signal 11 error? -

i using cocos2d-x build both win32 , android application. met fatal problem when seek port android win32. wrote next code in android seek read file assets. but, each time android application crashes @ ccfileutils::sharedfileutils()->getfiledata. don't know why. using code in other places, , work fine.

#if cc_target_platform == cc_platform_android unsigned long size = 0; cclog("filepath name %s",filename); unsigned char* filebuff = ccfileutils::sharedfileutils()->getfiledata(filename,"rb",&size); cclog("filebuff"); ccstring* ccstr = ccstring::createwithdata(filebuff,size); cclog("ccstr end"); runscriptbuffer(ccstr->getcstring(),ret_string,name); #endif

this whole function implementation:

bool cluascriptreader::runscriptfile(const char *filename,char* ret_string,char *name){ if( m_plua == null || ret_string == null || filename == null ) homecoming false; #if cc_target_platform == cc_platform_win32 char filebuff[max_lua_file_len] = ""; char line[1024] = ""; file* fpfile = fopen(filename,"r"); if( fpfile == null ) { printf("can not find file %s\n",filename); homecoming false; } while( fgets(line, 1024, fpfile) != null) { strcat(filebuff,line); } fclose(fpfile); runscriptbuffer(filebuff,ret_string,name); #endif #if cc_target_platform == cc_platform_android unsigned long size = 0; cclog("filepath name %s",filename); unsigned char* filebuff = ccfileutils::sharedfileutils()->getfiledata(filename,"rb",&size); cclog("filebuff %l",size); ccstring* ccstr = ccstring::createwithdata(filebuff,size); cclog("ccstr end"); runscriptbuffer(ccstr->getcstring(),ret_string,name); #endif homecoming true; }

following error log got using ndk-stack tool.

********** crash dump: ********** build fingerprint: 'google/yakju/maguro:4.3/jwr66y/776638:user/release-keys' pid: 20518, tid: 20541, name: thread-61225 >>> com.einverne.test_py <<< signal 11 (sigsegv), code 1 (segv_maperr), fault addr e72d2d24 stack frame #00 pc 00010354 /system/lib/libc.so (dlmalloc+1207): unable ope n symbol file d:\graduation_project\cocos2d-x-2.1.5\projects\test_py\proj.androi d\obj\local\armeabi\/libc.so. error (9): bad file descriptor stack frame #01 pc 0000dcc7 /system/lib/libc.so (malloc+10): unable open sy mbol file d:\graduation_project\cocos2d-x-2.1.5\projects\test_py\proj.android\ob j\local\armeabi\/libc.so. error (9): bad file descriptor stack frame #02 pc 0000aa98 /system/lib/libz.so (inflateinit2_+100) stack frame #03 pc 00523044 /data/app-lib/com.einverne.test_py-2/libcocos2dcpp .so (cocos2d::unzopencurrentfile3(void*, int*, int*, int, char const*)+836): rou tine unzopencurrentfile3 in d:\graduation_project\cocos2d-x-2.1.5/cocos2dx/suppo rt/zip_support/unzip.cpp:1618 stack frame #04 pc 00523138 /data/app-lib/com.einverne.test_py-2/libcocos2dcpp .so (cocos2d::unzopencurrentfile(void*)+40): routine unzopencurrentfile in d:\gr aduation_project\cocos2d-x-2.1.5/cocos2dx/support/zip_support/unzip.cpp:1677 stack frame #05 pc 0051d318 /data/app-lib/com.einverne.test_py-2/libcocos2dcpp .so (cocos2d::zipfile::getfiledata(std::string const&, unsigned long*)+360): rou tine getfiledata in d:\graduation_project\cocos2d-x-2.1.5/cocos2dx/support/zip_s upport/ziputils.cpp:561 stack frame #06 pc 004ef98c /data/app-lib/com.einverne.test_py-2/libcocos2dcpp .so (cocos2d::ccfileutilsandroid::getfiledata(char const*, char const*, unsigned long*)+252): routine getfiledata in d:\graduation_project\cocos2d-x-2.1.5/cocos 2dx/platform/android/ccfileutilsandroid.cpp:134 stack frame #07 pc 00243ab4 /data/app-lib/com.einverne.test_py-2/libcocos2dcpp .so (cluascriptreader::runscriptfile(char const*, char*, char*)+152): routine ru nscriptfile in jni/../../classes/luascriptreader.cpp:330 stack frame #08 pc 0023e704 /data/app-lib/com.einverne.test_py-2/libcocos2dcpp .so (judgemanager::getresult(std::string, std::string, std::string, characterext end*, std::string)+1004): routine getresult in jni/../../classes/judgemanager.cp p:87

edit: in android logcat got fatal signal 11 (sigsegv) @ 0xe72d2d24 (code=1), thread 26592 (thread-61675) error.

android c++ android-ndk cocos2d-x cocos2d-x-2.x

No comments:

Post a Comment