Have you ever faced a bizarre stack trace containing only memory locations, and praying god if you could find the code lines around/at crash is happening.
Here is a typical example of a stack trace generated by Android NDK when crash occurs in native code:
Lets try to understand what it is.
The PC stands for the program counter and #0 is the stack pointer where the crash happened.
There are several methods we can un- obfuscate this stack trace.
1. Addr2line : This tool can be found in toolchains/. In ndkr5
You can simply provide the addr at which the crash happened and it will generate the corresponding line number.
2 ndk-stack : This tool is available from revision 7 onwards. It takes two arguments
A. The library to look out for reference.
B. The crash dump. A plain txt file which contains the stack trace.
While coping the stack trace you should copy from the starting line which starts from "***** *****" like pattern. Because the current tool looks for this line as starting of the trace. It will be handled in the future versions.
3. Generate a Map file : you can always generate a map file which contains all addresses of classes and methods.
Thats it! Thanks for reading. Comments are solicited.
No comments:
Post a Comment