1.NDK编译jni时增加调试信息:
$NDK_ROOT/ndk-build -B NDK_DEBUG=1
2.发生崩溃时,logcat中收集日志:
09-11 14:41:15.220: D/dalvikvm(20580): Added shared lib /data/data/com.sec.android.psfcore/lib/libPSFCore_Android.so 0x42461598 09-11 14:41:15.220: V/JACK(20580): JNI_OnLoad 09-11 14:41:15.225: V/JACK(20580): JNI_OnLoad finished 09-11 14:41:15.225: A/libc(20580): Fatal signal 11 (SIGSEGV) at 0x00000005 (code=1), thread 20580 (android.psfcore) 09-11 14:41:15.330: I/DEBUG(1936): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 09-11 14:41:15.330: I/DEBUG(1936): Build fingerprint: 'samsung/m0ctc/m0ctc:4.1.1/JRO03C/I939KEDLK4:eng/test-keys' 09-11 14:41:15.330: I/DEBUG(1936): pid: 20580, tid: 20580, name: android.psfcore >>> com.sec.android.psfcore <<< 09-11 14:41:15.330: I/DEBUG(1936): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000005 09-11 14:41:15.485: I/DEBUG(1936): r0 00000000 r1 00000001 r2 00000000 r3 00000001 09-11 14:41:15.485: I/DEBUG(1936): r4 00000000 r5 5d427fcd r6 bee603c0 r7 40f814d0 09-11 14:41:15.485: I/DEBUG(1936): r8 bee615c0 r9 57b55d7c sl 40fa6b88 fp bee615d4 09-11 14:41:15.485: I/DEBUG(1936): ip 5d6aabd0 sp bee60370 lr 5d427303 pc 5d426a72 cpsr 40000030 09-11 14:41:15.485: I/DEBUG(1936): d0 0000000000000004 d1 3ff0000043a00000 09-11 14:41:15.485: I/DEBUG(1936): d2 0000000100000001 d3 0000000000000000 09-11 14:41:15.485: I/DEBUG(1936): d4 0000000000000000 d5 0000000000000000 09-11 14:41:15.485: I/DEBUG(1936): d6 00d00ff000000000 d7 0000013244000000 09-11 14:41:15.490: I/DEBUG(1936): d8 0000000000000000 d9 0000000000000000 09-11 14:41:15.490: I/DEBUG(1936): d10 0000000000000000 d11 0000000000000000 09-11 14:41:15.490: I/DEBUG(1936): d12 0000000000000000 d13 0000000000000000 09-11 14:41:15.490: I/DEBUG(1936): d14 0000000000000000 d15 0000000000000000 09-11 14:41:15.490: I/DEBUG(1936): d16 6e6f69746369645f d17 0000000000000000 09-11 14:41:15.490: I/DEBUG(1936): d18 0000000000000000 d19 0000000000000000 09-11 14:41:15.490: I/DEBUG(1936): d20 4008000000000000 d21 3fbc71c71c71c71c 09-11 14:41:15.490: I/DEBUG(1936): d22 3fcc7288e957b53b d23 3fd24998d6307188 09-11 14:41:15.490: I/DEBUG(1936): d24 3fd99a27ad32ddf5 d25 3fe555b0aaeac752 09-11 14:41:15.490: I/DEBUG(1936): d26 0000000000000000 d27 0000000000000000 09-11 14:41:15.490: I/DEBUG(1936): d28 0000000000000005 d29 0000000000000000 09-11 14:41:15.490: I/DEBUG(1936): d30 0000000000000000 d31 0000000000000000 09-11 14:41:15.490: I/DEBUG(1936): scr 60000010 09-11 14:41:15.490: I/DEBUG(1936): backtrace: 09-11 14:41:15.490: I/DEBUG(1936): #00 pc 001f4a72 /data/data/com.sec.android.psfcore/lib/libPSFCore_Android.so (__gnu_cxx::__normal_iterator<delegate::Delegate<void (std::string const&), CSimpleMutex>::ICallBack**, std::vector<delegate::Delegate<void (std::string const&), CSimpleMutex>::ICallBack*, std::allocator<delegate::Delegate<void (std::string const&), CSimpleMutex>::ICallBack*> > > delegate::Delegate<void (std::string const&), CSimpleMutex>::find<std::pair<Publ+15) 09-11 14:41:15.490: I/DEBUG(1936): #01 pc 001f52ff /data/data/com.sec.android.psfcore/lib/libPSFCore_Android.so (void delegate::Delegate<void (std::string const&), CSimpleMutex>::add<std::pair<PublishToAllJony*, void (PublishToAllJony::*)(std::string const&)> >(std::pair<PublishToAllJony*, void (PublishToAllJony::*)(std::string const&)> const&)+38) 09-11 14:41:15.490: I/DEBUG(1936): stack: 09-11 14:41:15.490: I/DEBUG(1936): bee60330 5d6abf88 /data/data/com.sec.android.psfcore/lib/libPSFCore_Android.so 09-11 14:41:15.490: I/DEBUG(1936): bee60334 d26bc41c 09-11 14:41:15.490: I/DEBUG(1936): bee60338 40f82e0c 09-11 14:41:15.490: I/DEBUG(1936): bee6033c 5d6abf88 /data/data/com.sec.android.psfcore/lib/libPSFCore_Android.so 09-11 14:41:15.490: I/DEBUG(1936): bee60340 c0000000 09-11 14:41:15.490: I/DEBUG(1936): bee60344 00000004 09-11 14:41:15.490: I/DEBUG(1936): bee60348 00000000 09-11 14:41:15.490: I/DEBUG(1936): bee6034c 00000000 09-11 14:41:15.490: I/DEBUG(1936): bee60350 4161dfc8 09-11 14:41:15.490: I/DEBUG(1936): bee60354 400374ab /system/lib/libc.so (dlmalloc+5326) 09-11 14:41:15.490: I/DEBUG(1936): bee60358 5d664db0 /data/data/com.sec.android.psfcore/lib/libPSFCore_Android.so 09-11 14:41:15.490: I/DEBUG(1936): bee6035c 5d65d038 /data/data/com.sec.android.psfcore/lib/libPSFCore_Android.so 09-11 14:41:15.490: I/DEBUG(1936): bee60360 c0000000 09-11 14:41:15.490: I/DEBUG(1936): bee60364 00000010 09-11 14:41:15.490: I/DEBUG(1936): bee60368 df0027ad 09-11 14:41:15.490: I/DEBUG(1936): bee6036c 00000000 09-11 14:41:15.490: I/DEBUG(1936): #00 bee60370 40f82314 09-11 14:41:15.490: I/DEBUG(1936): bee60374 bee603c0 [stack] 09-11 14:41:15.490: I/DEBUG(1936): bee60378 00000000 09-11 14:41:15.490: I/DEBUG(1936): bee6037c 00000001 09-11 14:41:15.490: I/DEBUG(1936): bee60380 40f82314 09-11 14:41:15.490: I/DEBUG(1936): bee60384 bee603c0 [stack] 09-11 14:41:15.490: I/DEBUG(1936): bee60388 00000000 09-11 14:41:15.490: I/DEBUG(1936): bee6038c 5d427303 /data/data/com.sec.android.psfcore/lib/libPSFCore_Android.so (void delegate::Delegate<void (std::string const&), CSimpleMutex>::add<std::pair<PublishToAllJony*, void (PublishToAllJony::*)(std::string const&)> >(std::pair<PublishToAllJony*, void (PublishToAllJony::*)(std::string const&)> const&)+42) 09-11 14:41:15.495: I/DEBUG(1936): #01 bee60390 40f82318 09-11 14:41:15.495: I/DEBUG(1936): bee60394 bee603c0 [stack] 09-11 14:41:15.495: I/DEBUG(1936): bee60398 40f814d0 09-11 14:41:15.495: I/DEBUG(1936): bee6039c 5d6aab88 /data/data/com.sec.android.psfcore/lib/libPSFCore_Android.so 09-11 14:41:15.495: I/DEBUG(1936): bee603a0 40f82300 09-11 14:41:15.495: I/DEBUG(1936): bee603a4 5d427b9f /data/data/com.sec.android.psfcore/lib/libPSFCore_Android.so (PublishToAllJony::PublishToAllJony(AllJoyn*, LocalReactor*)+106) 09-11 14:41:15.495: I/DEBUG(1936): bee603a8 00000000 09-11 14:41:15.495: I/DEBUG(1936): bee603ac 40f82dc8 09-11 14:41:15.495: I/DEBUG(1936): bee603b0 40f81450 09-11 14:41:15.495: I/DEBUG(1936): bee603b4 400374ab /system/lib/libc.so (dlmalloc+5326) 09-11 14:41:15.495: I/DEBUG(1936): bee603b8 40f81558 09-11 14:41:15.495: I/DEBUG(1936): bee603bc bee603ec [stack] 09-11 14:41:15.495: I/DEBUG(1936): bee603c0 40f814d0 09-11 14:41:15.495: I/DEBUG(1936): bee603c4 5d427fcd /data/data/com.sec.android.psfcore/lib/libPSFCore_Android.so (PublishToAllJony::on_command(std::string const&)) 09-11 14:41:15.495: I/DEBUG(1936): bee603c8 00000000 09-11 14:41:15.495: I/DEBUG(1936): bee603cc 0000004c 09-11 14:41:15.495: I/DEBUG(1936): memory near r5: 09-11 14:41:15.495: I/DEBUG(1936): 5d427fac 1c20b005 46c0bdf0 00282ca8 fffff4dc .. ....F.,(..... 09-11 14:41:15.495: I/DEBUG(1936): 5d427fbc fffff584 0023605c 0023603f 0023601a ....\`#.?`#..`#. 09-11 14:41:15.495: I/DEBUG(1936): 5d427fcc 4d86b5f0 4a874c86 682d447d 446a44a5 ...M.L.J}D-h.DjD 09-11 14:41:15.495: I/DEBUG(1936): 5d427fdc 1c0c682b 60134984 44794a84 447a1c06 +h...I.`.JyD..zD 09-11 14:41:15.495: I/DEBUG(1936): 5d427fec f7f02002 1c20ee98 f0862100 7803edd2 . .... ..!.....x 09-11 14:41:15.495: I/DEBUG(1936): memory near r6: 09-11 14:41:15.495: I/DEBUG(1936): bee603a0 40f82300 5d427b9f 00000000 40f82dc8 .#.@.{B].....-.@ 09-11 14:41:15.495: I/DEBUG(1936): bee603b0 40f81450 400374ab 40f81558 bee603ec [email protected].@X..@.... 09-11 14:41:15.495: I/DEBUG(1936): bee603c0 40f814d0 5d427fcd 00000000 0000004c [email protected]]....L... 09-11 14:41:15.495: I/DEBUG(1936): bee603d0 40f822e0 bee6048c 00000000 bee615c0 .".@............ 09-11 14:41:15.495: I/DEBUG(1936): bee603e0 57b55d7c 40fa6b88 bee615d4 40038f81 |].W.k.@.......@ 09-11 14:41:15.495: I/DEBUG(1936): memory near r7: 09-11 14:41:15.495: I/DEBUG(1936): 40f814b0 00000016 7664722f 2f31762f 72656570 ..../rdv/v1/peer 09-11 14:41:15.495: I/DEBUG(1936): 40f814c0 0073252f 3e656d61 3c207a20 00000053 /%s.ame> z <S... 09-11 14:41:15.495: I/DEBUG(1936): 40f814d0 5d6a4c40 5d6ad24c 00000000 00004000 @Lj]L.j].....@.. 09-11 14:41:15.495: I/DEBUG(1936): 40f814e0 00000001 00000000 00004000 00000001 .........@...... 09-11 14:41:15.495: I/DEBUG(1936): 40f814f0 00000000 00004000 00000001 00000000 .....@.......... 09-11 14:41:15.495: I/DEBUG(1936): memory near r8: 09-11 14:41:15.495: I/DEBUG(1936): bee615a0 412b0070 40f817cc aab0001d 57fe1b90 p.+[email protected] 09-11 14:41:15.495: I/DEBUG(1936): bee615b0 40fa6b78 00000000 57b55d84 40833ef4 xk.@.....].W.>.@ 09-11 14:41:15.495: I/DEBUG(1936): bee615c0 57b55d78 00000001 4247a4e0 4174a77b x].W......GB{.tA 09-11 14:41:15.495: I/DEBUG(1936): bee615d0 4245d6c4 40863147 57b55d78 4174a779 ..EBG1.@x].Wy.tA 09-11 14:41:15.495: I/DEBUG(1936): bee615e0 5d41e755 40fa6b88 00000000 00000000 U.A].k.@........ 09-11 14:41:15.495: I/DEBUG(1936): memory near r9: 09-11 14:41:15.495: I/DEBUG(1936): 57b55d5c 424790a8 00000000 57b55d94 4172ef6a ..GB.....].Wj.rA 09-11 14:41:15.495: I/DEBUG(1936): 57b55d6c 57fe1b90 00000006 00000000 5c400019 ...W..........@\ 09-11 14:41:15.500: I/DEBUG(1936): 57b55d7c aab0001d 57b55db4 5954ebc2 57fe07a8 .....].W..TY...W 09-11 14:41:15.500: I/DEBUG(1936): 57b55d8c 4172ef6a 00000000 4247a4e0 42478568 j.rA......GBh.GB 09-11 14:41:15.500: I/DEBUG(1936): 57b55d9c 42465b50 57b55e00 5954d80c 57d773f8 P[FB.^.W..TY.s.W 09-11 14:41:15.500: I/DEBUG(1936): memory near sl: 09-11 14:41:15.500: I/DEBUG(1936): 40fa6b68 40d588d0 00000000 00000000 00000453 [email protected]... 09-11 14:41:15.500: I/DEBUG(1936): 40fa6b78 595508d8 57b55d78 57fe07a8 4177c000 ..UYx].W...W..wA 09-11 14:41:15.500: I/DEBUG(1936): 40fa6b88 4247a4e0 d26bc41c bee61730 00000000 ..GB..k.0....... 09-11 14:41:15.500: I/DEBUG(1936): 40fa6b98 bee61764 00000001 00000000 40834080 d............@.@ 09-11 14:41:15.500: I/DEBUG(1936): 40fa6ba8 00000000 00000000 56fd8e70 57b50300 ........p..V...W 09-11 14:41:15.500: I/DEBUG(1936): memory near fp: 09-11 14:41:15.500: I/DEBUG(1936): bee615b4 00000000 57b55d84 40833ef4 57b55d78 .....].W.>.@x].W 09-11 14:41:15.500: I/DEBUG(1936): bee615c4 00000001 4247a4e0 4174a77b 4245d6c4 ......GB{.tA..EB 09-11 14:41:15.500: I/DEBUG(1936): bee615d4 40863147 57b55d78 4174a779 5d41e755 G1.@x].Wy.tAU.A] 09-11 14:41:15.500: I/DEBUG(1936): bee615e4 40fa6b88 00000000 00000000 0000005f .k.@........_... 09-11 14:41:15.500: I/DEBUG(1936): bee615f4 40072a6c 40037789 40f8160d 40f81728 l*[email protected].@...@(..@ 09-11 14:41:15.500: I/DEBUG(1936): memory near ip: 09-11 14:41:15.500: I/DEBUG(1936): 5d6aabb0 4002fd40 400347a8 400346c0 40033fa4 @[email protected][email protected].@.?.@ 09-11 14:41:15.500: I/DEBUG(1936): 5d6aabc0 40033ff8 400340ac 40033fb8 400e1649 .?.@.@.@.?.@I..@ 09-11 14:41:15.500: I/DEBUG(1936): 5d6aabd0 400342c0 400304c8 40034e0c 40034b18 .B.@[email protected][email protected].@ 09-11 14:41:15.500: I/DEBUG(1936): 5d6aabe0 400343b8 4003925c 40034ac0 400344ac .C.@\[email protected][email protected].@ 09-11 14:41:15.500: I/DEBUG(1936): 5d6aabf0 4004c895 4003e609 40041391 4003c2d5 ...@...@...@...@ 09-11 14:41:15.500: I/DEBUG(1936): memory near sp: 09-11 14:41:15.500: I/DEBUG(1936): bee60350 4161dfc8 400374ab 5d664db0 5d65d038 [email protected]]8.e] 09-11 14:41:15.500: I/DEBUG(1936): bee60360 c0000000 00000010 df0027ad 00000000 .........'...... 09-11 14:41:15.500: I/DEBUG(1936): bee60370 40f82314 bee603c0 00000000 00000001 .#.@............ 09-11 14:41:15.500: I/DEBUG(1936): bee60380 40f82314 bee603c0 00000000 5d427303 .#[email protected]] 09-11 14:41:15.500: I/DEBUG(1936): bee60390 40f82318 bee603c0 40f814d0 5d6aab88 .#.@[email protected]] 09-11 14:41:15.500: I/DEBUG(1936): code around pc: 09-11 14:41:15.500: I/DEBUG(1936): 5d426a50 edcaf088 bd761c30 f088a801 f09cedc6 ....0.v......... 09-11 14:41:15.500: I/DEBUG(1936): 5d426a60 b5f7efb4 6803688c 684d680f 21011c20 .....h.h.hMh ..! 09-11 14:41:15.500: I/DEBUG(1936): 5d426a70 685e4008 681b9001 cb04e012 d00f2a00 .@^h...h.....*.. 09-11 14:41:15.500: I/DEBUG(1936): 5d426a80 42b86850 6890d10c d10942a8 42a268d2 Ph.B...h.B...h.B 09-11 14:41:15.505: I/DEBUG(1936): 5d426a90 2d00d009 9801d104 d1012800 d002420a ...-.....(...B.. 09-11 14:41:15.505: I/DEBUG(1936): code around lr: 09-11 14:41:15.505: I/DEBUG(1936): 5d4272e0 d1062c00 f09d200c 6004eed4 60846044 .,... .....`D`.` 09-11 14:41:15.505: I/DEBUG(1936): 5d4272f0 1d286028 f7f19000 1c28ed1a f7ff1c31 (`(.......(.1... 09-11 14:41:15.505: I/DEBUG(1936): 5d427300 682bfbb0 4283685b 2010d122 eec0f09d ..+h[h.B".. .... 09-11 14:41:15.505: I/DEBUG(1936): 5d427310 447b4b14 1c1a681b 1c033208 1c32c304 .K{D.h...2....2. 09-11 14:41:15.505: I/DEBUG(1936): 5d427320 3304ca02 60419001 c3026871 601a6852 ...3..A`qh..Rh.` 09-11 14:41:15.580: I/DEBUG(1936): !@dumpstate -k -t -z -d -o /data/log/dumpstate_app_native -m 20580 09-11 14:41:15.580: I/BootReceiver(2377): Copying /data/tombstones/tombstone_02 to DropBox (SYSTEM_TOMBSTONE) 09-11 14:41:15.590: I/dumpstate(20614): begin
3.
/home/raozhengfeng/work/Library/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-addr2line -f -e libs/armeabi/libPSFCore_Android.so 001f52ff