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