How to truly reflect abnormal Android app addresses-debugging method for Android app exceptions: Stack tracking

Source: Internet
Author: User

During the Android Application Development Process, an exception may occur and a stack information is printed. Although the stack contains an abnormal address, use the arm-Linux-objdump command to decompile the dynamic library, but the corresponding address cannot be found. In fact, the JNI dynamic library developed by using ndk alone cannot decompile the real address using the dump command, because its address is dynamically allocated by the system, if you want to print the stack information to reflect the actual address, you need to put the code into the android SDK for joint compilation and specify an address space for the library. You can try the following methods:

 

 

Open Android-2.0/build/CORE/prelink-linux-arm.map, which specifies the address for most libraries, including the thread stack, data segment, Text Segment, heap, prelinked system library, prelinked application library, and non-prelinked library address space, and reserved enough space (this is a little troublesome, I don't know how to allocate this space. If it is too much, it may be a waste. If it is too little, it may be an error !), When you add a new library, note that you need to find the unused address space in the file and allocate the space to your new library.

 

Open the prelink-linux-arm.map file where:

Libomx_wmadec_sharedlibrary.so 0x66800000

# Sigma designs Libraries

Libcore. So 0x61400000

 

The space between the two addresses is large. Therefore, it can be in 0x66800000 ~ 0x61400000 (as if it was an address auto-reduction stack ??!) Address allocation.

 

Finally, put the code and library in the Android-2.0/external directory and compile and package all the updates to update the system. In this way, if an exception occurs in the application, you can find the abnormal code based on the stack information and The Decompilation file of the dynamic library.

 

 

Prelink-linux-arm.map analysis, prelink-linux-mips.map analysis, prelink-linux-arm.map usage, Android Application exception debugging method, stack tracking stacktrack

Related Article

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.