搞个jni,编译出so,作为apk的库,跑起来第一遍是好的,点击返回再进时就crash了。网上搜大部分说是内存开辟和释放不对的导致出错。后来用工具arm-eabi-addr2line -f -e xx.so 0xXXX查看是挂在dlmalloc.c中的tmalloc_large中,居然跑去看分析dlmalloc.c的blog:http://blog.chinaunix.net/uid-7907749-id-2037206.html。
上面分析确实蛮好的,但自己的问题还是没有头绪。最后是把代码不断的删除,发现是自己的编译.mk多链接libc.so的库,初步猜测是自己添加的libc的库跟系统的发生冲突了,等后面有时间时再回过头来看看。
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'yusu/ckt73_gb/ckt73_gb:2.3.4/GRJ22/eng.ckt.1352190295:eng/test-keys'
pid: 3883, tid: 3883 >>> com.example.testkey1 <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 014c04a2
r0 00000210 r1 00000002 r2 014c049e r3 00213000
r4 00580258 r5 00580258 r6 20000000 r7 00000010
r8 be8f3900 r9 429a7c90 10 429a7c78 fp 4368fac4
ip 00000004 sp be8f3830 lr 81e11137 pc 81e109fa cpsr 00000030
#00 pc 000109fa /mnt/asec/com.example.testkey1-1/lib/libtestkey1.so
#01 pc 00011132 /mnt/asec/com.example.testkey1-1/lib/libtestkey1.so
#02 pc 000115a0 /mnt/asec/com.example.testkey1-1/lib/libtestkey1.so
#03 pc 0000e4fa /mnt/asec/com.example.testkey1-1/lib/libtestkey1.so
#04 pc 0000481e /mnt/asec/com.example.testkey1-1/lib/libtestkey1.so
#05 pc 00004a60 /mnt/asec/com.example.testkey1-1/lib/libtestkey1.so
#06 pc 000180b4 /system/lib/libdvm.so
#07 pc 00049630 /system/lib/libdvm.so
#08 pc 0001d2c4 /system/lib/libdvm.so
#09 pc 00022654 /system/lib/libdvm.so
#10 pc 00021550 /system/lib/libdvm.so
#11 pc 0005fdf6 /system/lib/libdvm.so
#12 pc 0006782e /system/lib/libdvm.so
#13 pc 0001d2c4 /system/lib/libdvm.so
#14 pc 00022654 /system/lib/libdvm.so
#15 pc 00021550 /system/lib/libdvm.so
#16 pc 0005fc4a /system/lib/libdvm.so
#17 pc 0004c064 /system/lib/libdvm.so
#18 pc 000352a8 /system/lib/libandroid_runtime.so
#19 pc 0003612e /system/lib/libandroid_runtime.so
#20 pc 00008ca2 /system/bin/app_process
#21 pc 00014dfc /system/lib/libc.so
code around pc:
81e109d8 18ab447d 2a00685a 2600d02f d002291f
81e109e8 2619084b 1c071af6 1c3e40b7 25002300
81e109f8 68579503 43af2503 42a51a3d 1c25d301
81e10a08 2d00e005 2400d102 e0181c13 0ff71c13
81e10a18 270446bc 466744bc 695400bf 429458ba
code around lr:
81e11114 d9023441 42442001 4b2ce00d 447b1c34
81e11124 685e340b 43bc2707 d0042e00 f7ff1c20
81e11134 1e05fc21 4b26d130 6899447b d817428c
81e11144 695d1b0a d9072a0f 20011929 609a4310
81e11154 60486159 e016508a 609a2200 186c615a
stack:
be8f37f0 42b91464
be8f37f4 451d6584
be8f37f8 00000001
be8f37fc 00000001
be8f3800 405239d8
be8f3804 405239d8
be8f3808 80fa5600
be8f380c 42b91450
be8f3810 be8f3850
be8f3814 80f6bff3 /system/lib/libdvm.so
be8f3818 be8f3820
be8f381c 000effb0
be8f3820 be8f3830
be8f3824 405239d8
be8f3828 df002777
be8f382c e3a070ad
#00 be8f3830 76616a4c
be8f3834 616c2f61
be8f3838 000001b4
be8f383c 00a0050a
be8f3840 00000208
be8f3844 00000210
be8f3848 00000000
be8f384c 00004004
be8f3850 00000007
be8f3854 81e11137 /mnt/asec/com.example.testkey1-1/lib/libtestkey1.so
#01 be8f3858 81e17388
be8f385c 81e1294b /mnt/asec/com.example.testkey1-1/lib/libtestkey1.so
be8f3860 00000004
be8f3864 00000002
be8f3868 81e06803 /mnt/asec/com.example.testkey1-1/lib/libtestkey1.so
be8f386c 00000000
be8f3870 000001b6
be8f3874 be8f38e4
be8f3878 00000040
be8f387c 00000000
be8f3880 81e17388
be8f3884 81e115a5 /mnt/asec/com.example.testkey1-1/lib/libtestkey1.so
#02 be8f3888 be8f38e4
be8f388c 81e0e4fd /mnt/asec/com.example.testkey1-1/lib/libtestkey1.so
#03 be8f3890 be8f38e4
be8f3894 81e04823 /mnt/asec/com.example.testkey1-1/lib/libtestkey1.so
#04 be8f3898 81e128da /mnt/asec/com.example.testkey1-1/lib/libtestkey1.so
be8f389c 80f4d443 /system/lib/libdvm.so
be8f38a0 42b91484
be8f38a4 74aea0c2
be8f38a8 81e12742 /mnt/asec/com.example.testkey1-1/lib/libtestkey1.so
be8f38ac 81e127fd /mnt/asec/com.example.testkey1-1/lib/libtestkey1.so
be8f38b0 0000acc0
be8f38b4 81e1294b /mnt/asec/com.example.testkey1-1/lib/libtestkey1.so
be8f38b8 0000acc0
be8f38bc 81e16fd4
be8f38c0 00228ed8
be8f38c4 81e04a65 /mnt/asec/com.example.testkey1-1/lib/libtestkey1.so
#05 be8f38c8 00000000
be8f38cc 40530568
be8f38d0 00000018
be8f38d4 00000001
be8f38d8 405239d8
be8f38dc 40530568
be8f38e0 80fab218
be8f38e4 00000001
be8f38e8 40530568
be8f38ec be8f3920
be8f38f0 00000004
be8f38f4 00000000
be8f38f8 429a7c98
be8f38fc 80f180b8 /system/lib/libdvm.so
#06 be8f3900 42b91484
be8f3904 0000cf40
be8f3908 00000000
be8f390c 81e049ad /mnt/asec/com.example.testkey1-1/lib/libtestkey1.so
be8f3910 80f18280 /system/lib/libdvm.so
be8f3914 0000cf40
be8f3918 be8f3920
be8f391c 80f49633 /system/lib/libdvm.so
#07 be8f3920 429a7c8c
be8f3924 451d9a46
be8f3928 81e049ad /mnt/asec/com.example.testkey1-1/lib/libtestkey1.so
be8f392c 00176c48
be8f3930 80fa5600