Ndk-stack use (analyze native code stack)

Source: Internet
Author: User

Brief introduction:

This feature has been available since the NDK R6 version.

Role:

Ndk-stack can convert non-known memory address information into readable information.

For example, the following content

I/debug ( to): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***I/DEBUG ( to): Build fingerprint:'Generic/google_sdk/generic/:2.2/frf91/43546:eng/test-keys'I/DEBUG ( to): PID:351, Tid:351%GT;%GT;%GT; /data/local/ndk-tests/crasher <<<I/DEBUG ( to): Signal One(SIGSEGV), fault addr 0d9f00d8 I/DEBUG ( to): R0 0000af88 R1 0000a008 R2 baadf00d R3 0d9f00d8 I/DEBUG ( to): R400000004R5 0000a008 R6 0000af88 R7 00013c44 I/DEBUG ( to): R800000000R900000000  Ten 00000000Fp00000000I/DEBUG ( to): IP 0000959c SP BE956CC8 LR00008403PC 0000841e CPSR60000030I/DEBUG ( to):          #xxPC 0000841e/data/local/ndk-tests/crasher I/DEBUG ( to):          # onPC 000083fe/data/local/ndk-tests/crasher I/DEBUG ( to):          # GenevaPC 000083f6/data/local/ndk-tests/crasher I/DEBUG ( to):          #GenevaPC 000191ac/system/lib/libc.so I/DEBUG ( to):          #GenevaPC 000083ea/data/local/ndk-tests/crasher I/DEBUG ( to):          # toPc00008458/data/local/ndk-tests/crasher I/DEBUG ( to):          # .PC 0000d362/system/lib/libc.so I/DEBUG ( to):

After conversion to readable information:

Crash Dump: **********Build Fingerprint:'Generic/google_sdk/generic/:2.2/frf91/43546:eng/test-keys'PID:351, Tid:351>>>/data/local/ndk-tests/crasher <<<Signal One(SIGSEGV), fault addr 0d9f00d8 Stack Frame #xxPC 0000841e/data/local/ndk-tests/crasher:routine Zooinch/TMP/FOO/CRASHER/JNI/ZOO.C: -Stack Frame # onPC 000083fe/data/local/ndk-tests/crasher:routine Barinch/TMP/FOO/CRASHER/JNI/BAR.C:5Stack Frame # GenevaPC 000083f6/data/local/ndk-tests/crasher:routine My_comparisoninch/TMP/FOO/CRASHER/JNI/FOO.C:9Stack Frame #GenevaPC 000191ac/system/lib/libc.so Stack Frame #GenevaPC 000083ea/data/local/ndk-tests/crasher:routine Fooinch/TMP/FOO/CRASHER/JNI/FOO.C: -Stack Frame # toPc00008458/data/local/ndk-tests/crasher:routine Maininch/TMP/FOO/CRASHER/JNI/MAIN.C: +Stack Frame # .PC 0000d362/system/lib/libc.so

How to use:

Premise: Your code must be packaged using the NDK build. So the address information will be

$PROJECT _path/obj/local/<abi>

The <abi> is based on your phone's ABI. (For example: ' Armeabi ' is the default value)

Open your console, enter ($NDK is your environment variable, point to the NDK directory):

ADB Logcat | $NDK/ndk-stack-sym $PROJECT _path/obj/local/armeabi

Completed.

Ndk-stack use (analyze native code stack)

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.