Android NDK分段错误

Android NDK分段错误,第1张

概述在我的应用程序中,当我尝试在那个时间面向分段错误时将我的日志打印到文件中. 我正面临致命信号11. 我的日志功能是Native部分,我从Java调用它. logcat的: 01-01 00:09:38.968: A/libc(3905): Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1)01-01 00:09:38.976: D/Random(21 在我的应用程序中,当我尝试在那个时间面向分段错误时将我的日志打印到文件中.

我正面临致命信号11.

我的日志功能是Native部分,我从Java调用它.

logcat的:

01-01 00:09:38.968: A/libc(3905): Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1)01-01 00:09:38.976: D/Random(2185): Trip In List :false01-01 00:09:38.976: D/Random(2185): odometer :001-01 00:09:38.976: D/abc(3905): PreCheck conditions satisfIEd for WIFI Searching Timer01-01 00:09:39.601: I/DEBUG(1285): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***01-01 00:09:39.601: I/DEBUG(1285): Build fingerprint: 'androID:androID:4.0.4/IMM76I/eng.example.20120608.074924:eng/test-keys'01-01 00:09:39.601: I/DEBUG(1285): pID: 3905,tID: 3908  >>> com.demo.abc <<<01-01 00:09:39.601: I/DEBUG(1285): signal 11 (SIGSEGV),code 1 (SEGV_MAPERR),fault addr deadbaad01-01 00:09:39.601: I/DEBUG(1285):  r0 00000000  r1 00000027  r2 00000048  r3 0000000001-01 00:09:39.601: I/DEBUG(1285):  r4 00000000  r5 100ffadc  r6 00000000  r7 0000000001-01 00:09:39.601: I/DEBUG(1285):  r8 016b5760  r9 00000048  10 100ffc98  fp 00006b8b01-01 00:09:39.601: I/DEBUG(1285):  ip fffc25c4  sp 100ffad8  lr deadbaad  pc 4008ffd8  cpsr 6000013001-01 00:09:39.601: I/DEBUG(1285):  d0  0000000000000000  d1  000000000000000001-01 00:09:39.601: I/DEBUG(1285):  d2  0000000000000000  d3  000000000000000001-01 00:09:39.601: I/DEBUG(1285):  d4  0000000000000000  d5  000000000000000001-01 00:09:39.601: I/DEBUG(1285):  d6  0000000000000000  d7  000000000000000001-01 00:09:39.601: I/DEBUG(1285):  d8  0000000000000000  d9  000000000000000001-01 00:09:39.601: I/DEBUG(1285):  d10 0000000000000000  d11 000000000000000001-01 00:09:39.601: I/DEBUG(1285):  d12 0000000000000000  d13 000000000000000001-01 00:09:39.601: I/DEBUG(1285):  d14 0000000000000000  d15 000000000000000001-01 00:09:39.601: I/DEBUG(1285):  d16 0000000000000000  d17 000000000000000001-01 00:09:39.601: I/DEBUG(1285):  d18 0000000000000000  d19 0000000421d1217601-01 00:09:39.601: I/DEBUG(1285):  d20 0000008000000080  d21 000000000000000001-01 00:09:39.601: I/DEBUG(1285):  d22 3fb0f4a31edab38b  d23 3fede16b9c24a98f01-01 00:09:39.601: I/DEBUG(1285):  d24 3e66376972bea4d0  d25 00000000ffffffff01-01 00:09:39.601: I/DEBUG(1285):  d26 0000000000000000  d27 3fc554e7eb0eb47c01-01 00:09:39.601: I/DEBUG(1285):  d28 0000000000000000  d29 000000000000000001-01 00:09:39.601: I/DEBUG(1285):  d30 0000000000000000  d31 000000000000000001-01 00:09:39.601: I/DEBUG(1285):  scr 8000001201-01 00:09:39.882: I/DEBUG(1285):          #00  pc 00017fd8  /system/lib/libc.so01-01 00:09:39.882: I/DEBUG(1285):          #01  pc 000096c2  /system/lib/libcutils.so (mspace_merge_objects)01-01 00:09:39.882: I/DEBUG(1285): code around pc:01-01 00:09:39.882: I/DEBUG(1285): 4008ffb8 b13cb942 b1196821 6809460c d1fb2900  B.<.!h...F.h.)..01-01 00:09:39.882: I/DEBUG(1285): 4008ffc8 b31b6963 2eadf64b f6cd2127 24006ead  ci..K...'!...n.-01 00:09:39.882: I/DEBUG(1285): 4008ffd8 1000f88e e812f7f4 f7f52106 a902e8b0  .........!......01-01 00:09:39.882: I/DEBUG(1285): 4008ffe8 5380f04f 2006460a 94029304 f7f49403  O..S.F. ........01-01 00:09:39.882: I/DEBUG(1285): 4008fff8 4622ec6c 20024629 ec74f7f4 effef7f3  l."F)F. ..t.....01-01 00:09:39.882: I/DEBUG(1285): code around lr:01-01 00:09:39.882: I/DEBUG(1285): deadba8c ffffffff ffffffff ffffffff ffffffff  ................01-01 00:09:39.882: I/DEBUG(1285): deadba9c ffffffff ffffffff ffffffff ffffffff  ................01-01 00:09:39.882: I/DEBUG(1285): deadbaac ffffffff ffffffff ffffffff ffffffff  ................01-01 00:09:39.882: I/DEBUG(1285): deadbabc ffffffff ffffffff ffffffff ffffffff  ................01-01 00:09:39.882: I/DEBUG(1285): deadbacc ffffffff ffffffff ffffffff ffffffff  ................01-01 00:09:39.882: I/DEBUG(1285): memory map around addr deadbaad:01-01 00:09:39.882: I/DEBUG(1285): be9ba000-be9db000 [stack]01-01 00:09:39.882: I/DEBUG(1285): (no map for address)01-01 00:09:39.882: I/DEBUG(1285): ffff0000-ffff1000 [vectors]01-01 00:09:39.882: I/DEBUG(1285): stack:01-01 00:09:39.882: I/DEBUG(1285):     100ffa98  00000000  01-01 00:09:39.882: I/DEBUG(1285):     100ffa9c  00000000  01-01 00:09:39.882: I/DEBUG(1285):     100ffaa0  00000048  01-01 00:09:39.882: I/DEBUG(1285):     100ffaa4  018b1d10  [heap]01-01 00:09:39.882: I/DEBUG(1285):     100ffaa8  00000048  01-01 00:09:39.882: I/DEBUG(1285):     100ffaac  40092bcd  /system/lib/libc.so01-01 00:09:39.882: I/DEBUG(1285):     100ffab0  400d18b4  01-01 00:09:39.882: I/DEBUG(1285):     100ffab4  0000000d  01-01 00:09:39.882: I/DEBUG(1285):     100ffab8  00000000  01-01 00:09:39.882: I/DEBUG(1285):     100ffabc  40094167  /system/lib/libc.so01-01 00:09:39.882: I/DEBUG(1285):     100ffac0  40131000  01-01 00:09:39.882: I/DEBUG(1285):     100ffac4  100ffadc  01-01 00:09:39.882: I/DEBUG(1285):     100ffac8  00000000  01-01 00:09:39.882: I/DEBUG(1285):     100ffacc  00000000  01-01 00:09:39.882: I/DEBUG(1285):     100ffad0  df0027ad  01-01 00:09:39.882: I/DEBUG(1285):     100ffad4  00000000  01-01 00:09:39.882: I/DEBUG(1285): #00 100ffad8  00000000  01-01 00:09:39.882: I/DEBUG(1285):     100ffadc  fffffbdf  01-01 00:09:39.882: I/DEBUG(1285):     100ffae0  00000000  01-01 00:09:39.882: I/DEBUG(1285):     100ffae4  00000000  01-01 00:09:39.882: I/DEBUG(1285):     100ffae8  00000000  01-01 00:09:39.882: I/DEBUG(1285):     100ffaec  00000000  01-01 00:09:39.890: I/DEBUG(1285):     100ffaf0  00000000  01-01 00:09:39.890: I/DEBUG(1285):     100ffaf4  411d0010  /dev/ashmem/dalvik-heap (deleted)01-01 00:09:39.890: I/DEBUG(1285):     100ffaf8  41227b88  /dev/ashmem/dalvik-heap (deleted)01-01 00:09:39.890: I/DEBUG(1285):     100ffafc  400e46c5  /system/lib/libcutils.so01-01 00:09:39.890: I/DEBUG(1285): #01 100ffb00  00000000  01-01 00:09:39.890: I/DEBUG(1285):     100ffb04  400e46c5  /system/lib/libcutils.so01-01 00:09:39.890: I/DEBUG(1285):     100ffb08  40000110  01-01 00:09:39.890: I/DEBUG(1285):     100ffb0c  00000b4c  01-01 00:09:39.890: I/DEBUG(1285):     100ffb10  411d0018  /dev/ashmem/dalvik-heap (deleted)01-01 00:09:39.890: I/DEBUG(1285):     100ffb14  00000001  01-01 00:09:39.890: I/DEBUG(1285):     100ffb18  409cec68  /system/lib/libdvm.so01-01 00:09:39.890: I/DEBUG(1285):     100ffb1c  40986c37  /system/lib/libdvm.so01-01 00:09:39.890: I/DEBUG(1285):     100ffb20  00000061  01-01 00:09:39.890: I/DEBUG(1285):     100ffb24  41226d08  /dev/ashmem/dalvik-heap (deleted)01-01 00:09:39.890: I/DEBUG(1285):     100ffb28  016b5748  [heap]01-01 00:09:39.890: I/DEBUG(1285):     100ffb2c  41227a08  /dev/ashmem/dalvik-heap (deleted)01-01 00:09:39.890: I/DEBUG(1285):     100ffb30  00000000  01-01 00:09:39.890: I/DEBUG(1285):     100ffb34  100ffdd4  01-01 00:09:39.890: I/DEBUG(1285):     100ffb38  00000061  01-01 00:09:39.890: I/DEBUG(1285):     100ffb3c  5109be98  /dev/ashmem/dalvik-bitmap-2 (deleted)01-01 00:09:39.890: I/DEBUG(1285):     100ffb40  50c4fe98  /dev/ashmem/dalvik-bitmap-1 (deleted)01-01 00:09:39.890: I/DEBUG(1285):     100ffb44  000074f6  01-01 00:09:42.085: I/BootReceiver(1427): copying /data/tombstones/tombstone_01 to DropBox (SYstem_TOMBSTONE)

原生部分代码:

voID printDeBUGLog(char *modulename,char *log,...){    char logMessage[PATHLENGTH];    char tempString[PATHLENGTH];    printf("\nprintDeBUGLog : 1");    //fp is null,file is not open.    va_List argList;    printf("\nprintDeBUGLog : 2");    va_start(argList,log);    printf("\nprintDeBUGLog : 3");    vsnprintf(tempString,1048,log,argList);    printf("\nprintDeBUGLog : 4");    strcpy(logMessage,APPname);    printf("\nprintDeBUGLog : 5");    strcat(logMessage,DEBUG);    printf("\nprintDeBUGLog : 6");    strcat(logMessage,"[");    printf("\nprintDeBUGLog : 7");    strcat(logMessage,timestamp());    printf("\nprintDeBUGLog : 8");    strcat(logMessage,"][");    printf("\nprintDeBUGLog : 9");    strcat(logMessage,modulename);    printf("\nprintDeBUGLog : 10");    strcat(logMessage,"] ");    printf("\nprintDeBUGLog : 11");    strcat(logMessage,tempString);    va_end(argList);#if defined(CONSolE_LOG)    printf("\t%s\n",logMessage);#endif    if (g_logfileDesc != NulL)    {        if (g_deBUG)        {            //Check file Size.            /*if (getfileSize(g_logfileDesc) >= MAX_LOG_file_SIZE)            {                closeLogfile();                openLogfile();            }            if (fprintf(g_logfileDesc,"%s\n",logMessage) != (strlen(logMessage) + 1))            {                printf("\nfile Delete start from Queue \n");                removeUploadQueue();            }*/        }    }}

如果您需要更多相关代码,请与我们联系.

等待你的答复….

解决方法
char logMessage[5];char tempString[5];strcpy(logMessage,"1234");strcpy(tempString,"1234");strcat(logMessage,tempString);

可能(!)造成麻烦?

总结

以上是内存溢出为你收集整理的Android NDK分段错误全部内容,希望文章能够帮你解决Android NDK分段错误所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1127129.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-30
下一篇 2022-05-30

发表评论

登录后才能评论

评论列表(0条)

保存