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