當Android發生crash時會產生一個類似core dump的檔案在 /data/tombstones/tombstone_XX where XX is a number increased by one with each crash. 我們要如何使用該檔案呢?
tombstones_XX 檔案內容如下, 我們可以利用addr2line將pc所指的位置的function name給找出來
pid: 153, tid: 161 >>> system_server <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 43bf3000
r0 003dc4a0 r1 43bf3000 r2 00000400 r3 00000000
r4 002cbc98 r5 002cbc98 r6 00000000 r7 00000000
r8 00000001 r9 00000140 10 00000019 fp 00301e04
ip 8090a1e0 sp 43f1eb68 lr 80c92cbb pc afd0cdfc cpsr 20000010
d0 003b3a700033c9f8 d1 00301280002eb23b
d2 000000000000003b d3 0000000000000000
d4 43bbc00043bb8000 d5 43d4800043bb8000
d6 3f80000000000000 d7 000001e03f000000
d8 0000000000000000 d9 0000000000000000
d10 0000000000000000 d11 0000000000000000
d12 0000000000000000 d13 0000000000000000
d14 0000000000000000 d15 0000000000000000
d16 3effff003effff00 d17 3f80000041808889
d18 3f80000041c4cccd d19 0701070100700798
d20 0000000000000c27 d21 0000043f00890000
d22 0000000000000000 d23 0000000000000008
d24 3fc74721cad6b0ed d25 3fc39a09d078c69f
d26 0000000000000000 d27 0000000000000000
d28 0000000000000000 d29 0000000000000000
d30 0000000000000000 d31 0000000000000000
scr 20000010
#00 pc 0000cdfc /system/lib/libc.so
#01 pc 00092cb8 /system/lib/egl/libGLESv2_adreno200.so
#02 pc 00093814 /system/lib/egl/libGLESv2_adreno200.so
#03 pc 00093890 /system/lib/egl/libGLESv2_adreno200.so
#04 pc 000938bc /system/lib/egl/libGLESv2_adreno200.so
#05 pc 00095cce /system/lib/egl/libGLESv2_adreno200.so
#06 pc 0006526a /system/lib/egl/libGLESv2_adreno200.so
#07 pc 000655cc /system/lib/egl/libGLESv2_adreno200.so
#08 pc 000188c4 /system/lib/egl/libGLESv1_CM_adreno200.so
#09 pc 000265ca /system/lib/libsurfaceflinger.so
#10 pc 0001b04c /system/lib/libsurfaceflinger.so
#11 pc 0001bda8 /system/lib/libsurfaceflinger.so
#12 pc 0001bf52 /system/lib/libsurfaceflinger.so
#13 pc 00020f3c /system/lib/libsurfaceflinger.so
#14 pc 00023df6 /system/lib/libsurfaceflinger.so
#15 pc 000259de /system/lib/libsurfaceflinger.so
#16 pc 0001c52c /system/lib/libutils.so
#17 pc 0001ca8a /system/lib/libutils.so
#18 pc 00011bc4 /system/lib/libc.so
#19 pc 00011790 /system/lib/libc.so
1. Android 產生出來的還沒進行strip的執行檔或shared libraries 是放在$android_root/out/target/product/YOUR_PRODUCT_NAME/symbols/system/bin 與 $android_root/out/target/product/YOUR_PRODUCT_NAME/symbols/system/lib目 錄下
2. Android所使用的toolchain是放在$android_root/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/ 下面
3. 假設我們要看 #09 pc 000265ca /system/lib/libsurfaceflinger.so 是 call 到哪一個function
(假設tombstone_XX 是在 $android_root 目錄下)
$ ./prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-addr2line -f -e ./out/target/product/YOUR_PRODUCT_NAME/symbols/system/lib/libsurfaceflinger.so 0x000265ca
它會show出_ZN7android14TextureManager12initEglImageEPNS_5ImageEPvRKNS_2spINS_13GraphicBufferEEE
$android_root/frameworks/base/services/surfaceflinger/TextureManager.cpp:164 這樣的訊息
No comments:
Post a Comment