Minidump總結
記錄一下如何使用minidump解析crash.dmp文件
1. Build symbols (symbols will put into "objdir-gecko/dist/crashreporter-symbols/"):
在項目根目錄下執行:
$ . setup.sh && make buildsymbols
2.獲取minidump的原始文件:/data/b2g/mozilla/CrashReports/pending/
(dumpfile (xxx.dmp) and extra file will save under “/data/b2g/mozilla/Crash
Reports/pending/” if you didn't send them to server)
3.使用(minidump_stackwalk)解析轉儲原始文件爲可讀的dump_result.txt
有兩種方式獲取minidump_stackwalk工具:
3.1
方法一:
minidump_stackwalk 下載路徑:http://hg.mozilla.org/build/tools/file/tip/breakpad/
3.2
方法二:
使用Google Breakpad
eg:
3.2.1:
下載Google Breakpad源碼
git clone https://github.com/google/breakpad
3.2.2:
git clone https://chromium.googlesource.com/linux-syscall-support
(代碼中很多地方引用了#include "third_party/lss/linux_syscall_support.h"這個Linux調用庫,但源碼中並沒有給出lss目錄,所以我們需要自己翻牆去下載https://chromium.googlesource.com/linux-syscall-support/源碼,並將lss目錄拷貝到third_party下,否則編譯不過。)
3.2.3:
在源碼目錄下執行:
./configure && make
make install
--------------
這樣在你編譯Breakpad成功後,就可以使用Breakpad下的minidump_stackwalker 工具來根據 minidump 文件生成堆棧跟蹤log
eg: /local/pier2_kk_3G/KaiOS$ minidump_stackwalk 4.dmp >dump_result.txt
或者: minidump_stackwalk dumpfile(xxx.dump) objdir-gecko/dist/crashreporter-symbols/ > dump_result.txt
成功的dump_result.txt
大致內容如下:
Operating system: Android
0.0.0 Linux 4.4.83 #1 SMP PREEMPT Tue Sep 24 11:28:43 CST 2019 armv7l
CPU: arm
ARMv1 ARM part(0x4100d030) features: half,thumb,fastmult,vfpv2,edsp,neon,vfpv3,tls,vfpv4,idiva,idivt
2 CPUs
GPU: UNKNOWN
Crash reason: SIGSEGV /0x00000000
Crash address: 0x0
Process uptime: not available
Thread 14 (crashed)
0 libmozglue.so + 0x2c82e
r0 = 0x000000e5 r1 = 0xb05ff08c r2 = 0x00000021 r3 = 0x00000000
r4 = 0xb05ff544 r5 = 0x00000003 r6 = 0xb6e7d1f8 r7 = 0xb6e7d150
r8 = 0xb4b86b31 r9 = 0xb656cb58 r10 = 0x00000000 r12 = 0x00000003
fp = 0xadc1d358 sp = 0xb05ff508 lr = 0xb6ebf82b pc = 0xb6ebf82e
Found by: given as instruction pointer in context
1 libxul.so + 0x3fad65
sp = 0xb05ff510 pc = 0xb4b86d67
Found by: stack scanning
2 libxul.so + 0x1d86ad0
sp = 0xb05ff520 pc = 0xb6512ad2
Found by: stack scanning
Thread 0
0 libc.so + 0x21888
r0 = 0xae2f1e10 r1 = 0x00000080 r2 = 0x00000000 r3 = 0x00000000
r4 = 0xae2f1e10 r5 = 0xae2f1e04 r6 = 0x00000000 r7 = 0x000000f0
r8 = 0xffffffff r9 = 0xb6f02168 r10 = 0x00000001 r12 = 0x00000000
fp = 0xb3829f78 sp = 0xbe97ca48 lr = 0xb6e42054 pc = 0xb6e54888
Found by: given as instruction pointer in context
1 libmozglue.so + 0x2a447
sp = 0xbe97ca60 pc = 0xb6ebd449
Found by: stack scanning
2 libmozglue.so + 0x2a94f
sp = 0xbe97ca68 pc = 0xb6ebd951
Found by: stack scanning
3 libnss3.so + 0x114761
sp = 0xbe97ca88 pc = 0xb46eb763
Found by: stack
-------------------------------
3.2.4:
addr2line
然後就可以使用addr2line 進行符號解析.從而追溯到對應該的堆棧信息.
(符號解析,可以使用 ndk 中提供的addr2line來根據地址進行一個符號反解的過程)
eg:
arm-linux-androideabi-addr2line -f -C -e (對於的.so庫文件) (符號地址)