Use Addr2line to analyze native information in Android

Source: Internet
Author: User

System: Ubuntu12.04

Mobile phone System: Android5.0

In the development process of Android there will be a lot of native bug must be analyzed with addr2line, and this tool is also very useful. Let's take a look at the specific use.

The version to be burned to the phone and the compiled version on your computer to be consistent, the data is accurate, just to locate the line.

First find your own computer available addr2line, with the command find. -name *addr2line. Mine is as follows

@njws19: ~/qcom8974_l_row/linux/android$ Find. -name *addr2line
./external/chromium_org/build/android/pylib/symbols/mock_addr2line
./external/chromium_org/build/android/pylib/symbols/mock_addr2line/mock_addr2line
./prebuilts/gcc/darwin-x86/arm/arm-linux-androideabi-4.8/bin/arm-linux-androideabi-addr2line
./prebuilts/gcc/darwin-x86/arm/arm-eabi-4.8/bin/arm-eabi-addr2line

/prebuilts/gcc/darwin-x86/x86/x86_64-linux-android-4.8/bin/x86_64-linux-android-addr2line
./prebuilts/gcc/darwin-x86/mips/mipsel-linux-android-4.8/bin/mipsel-linux-android-addr2line
./prebuilts/gcc/darwin-x86/mips/mips64el-linux-android-4.8/bin/mips64el-linux-android-addr2line
./prebuilts/gcc/darwin-x86/mips/mips64el-linux-android-4.9/bin/mips64el-linux-android-addr2line
./prebuilts/gcc/darwin-x86/aarch64/aarch64-linux-android-4.8/bin/aarch64-linux-android-addr2line
./prebuilts/gcc/darwin-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-addr2line
./prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.8/bin/arm-linux-androideabi-addr2line
./prebuilts/gcc/linux-x86/arm/arm-eabi-4.8/bin/arm-eabi-addr2line
./prebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.8/bin/x86_64-linux-android-addr2line
./prebuilts/gcc/linux-x86/x86/x86_64-linux-android-4.9/bin/x86_64-linux-android-addr2line
./prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6/bin/x86_64-linux-addr2line
./prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.8/bin/x86_64-linux-addr2line
./prebuilts/gcc/linux-x86/host/x86_64-w64-mingw32-4.8/bin/x86_64-w64-mingw32-addr2line
./prebuilts/gcc/linux-x86/mips/mipsel-linux-android-4.8/bin/mipsel-linux-android-addr2line
./prebuilts/gcc/linux-x86/mips/mips64el-linux-android-4.8/bin/mips64el-linux-android-addr2line
./prebuilts/gcc/linux-x86/mips/mips64el-linux-android-4.9/bin/mips64el-linux-android-addr2line
./prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8/bin/aarch64-linux-android-addr2line
./prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-addr2line
./prebuilts/tools/gcc-sdk/addr2line

You can easily find a usable addr2line to use, I choose here is./prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6/bin/x86_64- Linux-addr2line

The first is to compile an eng version on the computer, burn to the phone, in the test or debugging process error, check the error message is as follows:

02-13 14:56:12.140 6180 11596 F libc:fatal signal 6 (SIGABRT), code-6 in Tid 11596 (Pool_albumlabel)
02-13 14:56:12.149 4549 4579 D Foregroundutils:process died; UID 7721 PID
02-13 14:56:12.149 4549 4579 D foregroundutils:foreground changed, pid:7721 uid:1000 foreground:false
02-13 14:56:12.149 4549 4579 D foregroundutils:foreground uid/pid combinations:
02-13 14:56:12.149 4549 4579 D foregroundutils:uid:10031 pid:6180
02-13 14:56:12.154 6180 11587 E wwf5:ondrawframe End
02-13 14:56:12.171 6180 11587 E wwf5:ondrawframe End
02-13 14:56:12.185 6180 11587 E wwf5:ondrawframe End
02-13 14:56:12.189 298 399 I thermalengine:sensor:tsens_tz_sensor6:77000 MC
02-13 14:56:12.208 275 275 I DEBUG: * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
02-13 14:56:12.208 275 275 I debug:build fingerprint: ' lenovo/kingdom_row/kingdom_row:5.0.2/lrx22g/k920_s205_150205_ Row:eng/release-keys '
02-13 14:56:12.208 275 275 I debug:revision: ' 0 '
02-13 14:56:12.208 275 275 I debug:abi: ' Arm '
02-13 14:56:12.208 275 275 I debug:pid:6180, tid:11596, Name:pool_albumlabel >>> COM.XXXX.SCG <<<
02-13 14:56:12.208 275 275 I debug:signal 6 (SIGABRT), code-6 (Si_tkill), fault addr--------
02-13 14:56:12.245 275 275 I Debug:r0 00000000 R1 00002d4c R2 00000006 R3 00000000
02-13 14:56:12.245 275 275 I debug:r4 777CDDB8 R5 00000006 R6 0000000c R7 0000010c
02-13 14:56:12.245 275 275 I debug:r8 00000004 R9 00000cc0 SL 00000000 FP 00000000
02-13 14:56:12.245 275 275 I debug:ip 00002d4c sp 777cb338 lr b6f510a1 pc b6f7404c CPSR 600f0010
02-13 14:56:12.245 275 275 I DEBUG:
02-13 14:56:12.245 275 275 I debug:backtrace:
02-13 14:56:12.245 275 275 I DEBUG: #00 pc 0003704c/system/lib/libc.so (tgkill+12)
02-13 14:56:12.245 275 275 I DEBUG: #01 pc 0001409d/system/lib/libc.so (pthread_kill+52)
02-13 14:56:12.245 275 275 I DEBUG: #02 pc 00014cbb/system/lib/libc.so (raise+10)
02-13 14:56:12.245 275 275 I DEBUG: #03 pc 00011511/system/lib/libc.so (__libc_android_abort+36)
02-13 14:56:12.245 275 275 I DEBUG: #04 pc 0000fc94/system/lib/libc.so (abort+4)
02-13 14:56:12.246 275 275 I DEBUG: #05 pc 0014a1e7/system/lib/libskia.so (Sk_throw () +2)
02-13 14:56:12.246 275 275 I DEBUG: #06 pc 0014a21d/system/lib/libskia.so (sk_malloc_flags (unsigned int, unsigned int) +2 0)
02-13 14:56:12.246 275 275 I DEBUG: #07 pc 000dd0a5/system/lib/libskia.so
02-13 14:56:12.246 275 275 I DEBUG: #08 pc 0013b3d5/system/lib/libskia.so (Skpngimagedecoder::ondecodesubset, Skirect const&) +604)
02-13 14:56:12.246 275 275 I DEBUG: #09 pc 00137553/system/lib/libskia.so (skimagedecoder::d ecodesubset (SkBitmap*, SkIRe CT const&, skcolortype) +14)
02-13 14:56:12.246 275 275 I DEBUG: #10 pc 0008e383/system/lib/libandroid_runtime.so
02-13 14:56:12.246 275 275 I DEBUG: #11 pc 0000d189/data/dalvik-cache/arm/[email protected]@boot. Oat

If you want to find this line of error 02-13 14:56:12.246 275 275 I DEBUG: #08 pc 0013b3d5/system/lib/libskia.so (Skpngimagedecoder::ondecodesubset ( skbitmap*, Skirect const&) +604)

Error code information can be found on the computer (in the Android directory you compiled the system): libskia.so

Find the results below

@njws19: ~/qcom8974_l_row/linux/android/out/target$ find-name libskia.so
./product/kingdom_row/obj/lib/libskia.so
./product/kingdom_row/obj/shared_libraries/libskia_intermediates/linked/libskia.so
./product/kingdom_row/obj/packaging/target_files_intermediates/kingdom_row-target_files-k920_s204_150127_row/ System/lib/libskia.so
./product/kingdom_row/obj/packaging/target_files_intermediates/kingdom_row-target_files-k920_s205_150205_row/ System/lib/libskia.so
./product/kingdom_row/symbols/system/lib/libskia.so
./product/kingdom_row/system/lib/libskia.so

The useful information is this line, with the symbols typeface./product/kingdom_row/symbols/system/lib/libskia.so
This allows you to use Addr2line to find the number of file rows that have failed.

@njws19: ~/qcom8974_l_row/linux/android$./prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6/bin/x86_64- Linux-addr2line-e. /.. /.. /qcom8974_l_row/linux/android/out/target/product/kingdom_row/symbols/system/lib/libskia.so 0013B3D5
/home/xxx/qcom8974_l_row/linux/android/external/skia/src/images/skimagedecoder_libpng.cpp:907

Error on skimagedecoder_libpng.cpp:907 line

Use Addr2line to analyze native information in Android

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.