How to debug tombstone occurring in Android
The following three types of problems are more likely to occur in Android: Force Close/anr/tombstone
The first two are mainly to look at the current process or system framework layer state and stack can be analyzed, this article mainly discusses the situation of Tombstone.
Tombstone is generally caused by Dalvik errors, State monitoring debuggers, C-layer code, and some libc problems.
When the system occurs tombstone, kernel first will report a serious warning signal (signal), the upper layer received, the process of debugging tools will be in the process of the call stack at the scene to save, and the system created a data/ Tombstones directory After the exception of the process information is written in this directory, developers need to use the call stack to analyze the entire call process to find the point of the problem.
Basic tools:
Prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin
Reading the assembly carefully at the time of analysis will get more useful information when the exception occurs.
1.arm-eabi-addr2line translation of Call stack 16 binary values similar to libxxx.so 0x00012345 into filenames and function names
ARM-EABI-ADDR2LINE-E libxxx.so 0x00012345
2.ARM-EABI-NM listing symbol information for a file
Arm-eabi-nm-l-c-n-S libdvm.so > Dvm.data
3.arm-eabi-objdump listing the details of a file
Arm-eabi-objdump-c-D libc.so > Libc.s
Through the analysis of the above tools, we can get a more complete call stack and call logic assembly code.
Then you need to combine the knowledge of ARM architecture with arm compilation (in some cases gdb may be required)
To analyze the causes of tombstone, the following are some of the tombstone I have encountered:
1. Invalid function pointer: null pointer or already re-assigned value
2.strlen crashes: Causes incomplete stack information, stack is destroyed
3.FILE operation: Because the stdio is not thread-safe, it is prone to exceptions when multithreaded operations occur.
The main logic of the tombstone processing involved in this article is the following file:
Bootreceiver.java--Frameworks\base\services\java\com\android\server
DEBUGGERD.C--System\core\debuggerd
Threadlocal.java--Libcore\luni\src\main\java\java\lang