问题描述
正如我已经注意到了,logcat的回报总是三四线崩溃日志中,像这样的:
As I have noticed, logcat returns always 34 lines of crashlog, like this:
4cf7c700 401c0000
4cf7c704 48463ff0
4cf7c708 44d11f7c
4cf7c70c afd0cd89
4cf7c710 00000000
4cf7c714 82ab29dc libmyproject.so
4cf7c718 00000000
4cf7c71c 4cf7c73c
4cf7c720 836c44f0 libmyproject.so
4cf7c724 82f3a414 libmyproject.so
4cf7c728 4cf7c768
4cf7c72c 0000008d
4cf7c730 007ea0a8 [heap]
4cf7c734 00270100 [heap]
4cf7c738 e3a07077
4cf7c73c ef900077
4cf7c740 00000000
4cf7c744 4cf7c774
4cf7c748 836c44f0 libmyproject.so
4cf7c74c 00000000
4cf7c750 836c44f0 libmyproject.so
4cf7c754 82f63768 libmyproject.so
4cf7c758 00000000
4cf7c75c 4cf7c7e4
4cf7c760 00000000
4cf7c764 00000001
4cf7c768 00000000
4cf7c76c 0badc0de
4cf7c770 fffffff8
4cf7c774 00000000
4cf7c778 00000168
4cf7c77c 00000009
4cf7c780 00000200
4cf7c784 00000000
不过,我知道,堆栈也保存到 /日期/墓碑/ tombstone_0 [0-9]
。在那里,我可以找到很多其他的堆栈(我不是完全由他们来自哪里懂的),其中一些是两倍的时间比上述堆栈。
However I know that stack is also saved to /date/tombstones/tombstone_0[0-9]
. There I can find many other stacks (I am not fully understand from where they came from) and some of them are twice as long than aforementioned stack.
如何从我的应用程序的崩溃得到这么久堆栈转储?
How to get so long stack dump from crash of my application?
推荐答案
这次事故处理程序在Android中,这就是所谓的debuggerd,只写栈入日志的一部分,但完整的堆栈写入墓碑文件。这是很难codeD系统/核心/ debuggerd / debuggerd.c。
The crash handling program in android, which is called debuggerd, only writes a portion of the stack into the log, but writes the full stack into the tombstone file. This is hardcoded in system/core/debuggerd/debuggerd.c.
看在例行debug_stack_and_ code()的调用_log()。第二个参数_log控制的东西是否也仅限于墓碑,或将日志和墓碑。
Look in the routine debug_stack_and_code() for the calls to _LOG(). The second parameter to _LOG controls whether stuff goes only to the tombstone, or to the log and the tombstone.
如果您看到(sp_depth> 2 || only_in_tombstone)
,你可以改变2到别的东西拿到报告在日志中更深层次的堆栈帧。这是假设你可以重新编译debuggerd然后将其装在系统上。如果没有,你坚持检查墓碑文件本身有较长的堆栈转储。
Where you see (sp_depth>2||only_in_tombstone)
, you can change the 2 to something else to get deeper stack frames reported in the log. This assumes that you can re-compile debuggerd and replace it on your system. If not, you're stuck with examining the tombstone files themselves for the longer stack dumps.
转储由debuggerd在Linux下的程序崩溃创建。发生这种情况时,内核将发出一个信号,垂死的计划。这个信号被捕获由安装在每一个原生的Android应用程序,一个特殊的信号处理程序。通过仿生C库。信号处理程序触点debuggerd(通过命名管道),然后使用ptrace的读取寄存器和存储器生产墓碑和日志条目后面连接到垂死的程序。
The dumps are created by debuggerd when a program crashes under Linux. When this happens, the kernel will send a signal to the dying program. This signal is caught by a special signal handler installed in every native Android app. by the bionic C library. The signal handler contacts debuggerd (via a named pipe), which then connects back to the dying program using ptrace to read registers and memory to produce the tombstone and log entries.
这篇关于如何从机器人变长堆栈转储(墓碑)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!