A/libc: Fatal signal 5 (SIGTRAP), code 1 (TRAP_BRKPT), fault addr
int readAllData(){ //char* strPath = "test.264"; LOGE(" 1211 strPath= %s", strPath); FILE* fp = fopen(strPath, "rb"); if (fp == NULL) { LOGE(" 1211 fp == null"); return ; } char buf[1024]; int buf_len = 1024; int mHas = 1; int mBytesRead = 0; while (mHas){ if (fread(buf, 1, buf_len, fp) != buf_len) { fclose(fp); mHas = 0; } memcpy(gBuffer + mBytesRead,buf,buf_len); mBytesRead += buf_len; } LOGE("1211 ab2 %d,%d",gBytesRead , mBytesRead); gBytesRead = mBytesRead; return 1; }
原来是一个分支没返回值,改为return 0,就好了,看来ndk 和 普通cpp报错还不一样,to thi