一。项目中接入breakpad
二。拿到崩溃的dmp文件
三。下载breakpad源码https://github.com/google/breakpad
,在Linux环境下编译。
编译时,我这里遇到错误,缺少 src/third_party/lss/linux_syscall_support.h
去github上搜索下载这个文件(原Google的git连接已经失效),https://github.com/webrtcmirrors/vendor_linux-syscall-support,我用的是这个。注意很多是针对MIPS的,并不适用。
四。使用编译出的工具分析dmp
./src/processor/minidump_stackwalk 2/0702_1427.dmp > 1.txt
五。打开1.txt
Operating system: Android
0.0.0 Linux 3.18.31-perf-g4925c2f-dirty #1 SMP PREEMPT Fri Jun 8 10:21:45 CST 2018 armv8l
CPU: arm
ARMv1 ARM part(0x4100d030) features: half,thumb,fastmult,vfpv2,edsp,neon,vfpv3,tls,vfpv4,idiva,idivt
8 CPUs
GPU: UNKNOWN
Crash reason: SIGSEGV /0x00000000
Crash address: 0xc
Process uptime: not available
Thread 66 (crashed)
0 libmupdf_java32.so + 0x4b80c
r0 = 0xf34f4984 r1 = 0xca7980a6 r2 = 0x00000000 r3 = 0x6431cd2e
r4 = 0xd3b91dd4 r5 = 0xcd84b8cc r6 = 0xcd84b9c0 r7 = 0xcd84b8a8
r8 = 0xd61a5830 r9 = 0x00000000 r10 = 0xd611138c r12 = 0xf34fbb88
fp = 0xcd84b94c sp = 0xcd84b800 lr = 0xf31613cd pc = 0xca63c80c
Found by: given as instruction pointer in context
1 dalvik-LinearAlloc (deleted) + 0xcb6e
....很长
找到Crash reason
0 libmupdf_java32.so + 0x4b80c 崩溃时的寄存器地址
六。使用ndk自带的工具分析出崩溃的方法名
E:\ndk-r14b\toolchains\arm-linux-androi
deabi-4.9\prebuilt\windows-x86_64\bin\arm-linux-androideabi-addr2line.exe -f -C -e D:\ubuntu_share\breakpad\libmupdf_jav
a32.so 0x4b80c
得到崩溃时的方法为
Java_com_xxx_pdflib_mupdf_MuPDFCore_text