Android tombstone

sancaiodm Bug异常与ODM定制 2022-12-01 1095 0

Android中较容易出现以下三类问题:Force close / ANR / Tombstone

Tombstone 俗称“墓碑,在android系统中“墓碑”则是给进程准备的。

tombstoned进程是开机就启动的,开机时注册好了socket等待监听.


Tombstone 主要是给Native 层的进程准备的,主要用于分析NativeCrash。因为Kernel Crash整个系统直接就panic了,内核会打印出对应的call trace,对于Java层的代码出错也会有对应的异常抛出的。所以墓碑主要是给Native层的进程准备的


前两者主要是查看当前的进程或者系统框架层的状态和堆栈就基本可以分析出来,本文主要讨论一下tombstone的情况。

tombstone一般是由Dalvik错误、状态监视调试器、C层代码以及libc的一些问题导致的

当系统发生tombstone的时候,kernel首先会上报一个严重的警告信号(signal),上层接收到之后,进程的调试工具会把进程中当时的调用栈现场保存起来,

并在系统创建了data/tombstones目录后把异常时的进程信息写在此目录里面,开发者需要通过调用栈来分析整个调用流程来找出出问题的点。


当android系统出现异常时,会在/data/tombstones目录生成对应的tombstone文件

signal 11 (SIGSEGV), code 1 (SEGV_MAPERR),一般都是空指针错误


tombstone日志大概格式:

-------- beginning of crash

F/libc    (  244): invalid address or address of corrupt block 0xb82f54a0 passed to dlfree

I/libc    (  244): debuggerd_signal_handler called: signal=11, fn=0xb6fbdaa1

F/libc    (  244): Fatal signal 11 (SIGSEGV), code 1, fault addr 0xdeadbaad in tid 244 (mediaserver)

I/libc    (  244): exit from debuggerd_signal_handler

W/NativeCrashListener(  916): Couldn't find ProcessRecord for pid 244

I/DEBUG  (  241): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***

E/DEBUG  (  241): AM write failure (32 / Broken pipe)

I/DEBUG  (  241): Build fingerprint: XXXXXXXXX

I/DEBUG  (  241): Revision: '0'

I/DEBUG  (  241): ABI: 'arm'

I/DEBUG  (  241): pid: 244, tid: 244, name: mediaserver  >>> /system/bin/mediaserver <<<

I/DEBUG  (  241): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xdeadbaad

I/art    ( 3078): now dumpable=1

I/DEBUG  (  241): Abort message: 'invalid address or address of corrupt block 0xb82f54a0 passed to dlfree'

I/DEBUG  (  241):    r0 00000000  r1 b6f20dec  r2 deadbaad  r3 00000000

I/DEBUG  (  241):    r4 b82f54a0  r5 b6f220f8  r6 00000000  r7 42424242


----- timezone:Asia/Seoul

01-01 09:00:32.176013   979   979 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***

01-01 09:00:32.176263   979   979 F DEBUG   : Build fingerprint: 'xxxxx/10028:user/release-keys'

01-01 09:00:32.176368   979   979 F DEBUG   : Revision: '0'

01-01 09:00:32.176429   979   979 F DEBUG   : ABI: 'arm'

01-01 09:00:32.176481   979   979 F DEBUG   : Timestamp: 2010-01-01 09:00:32.048141001+0900

01-01 09:00:32.176534   979   979 F DEBUG   : Process uptime: 0s

01-01 09:00:32.176607   979   979 F DEBUG   : Cmdline: /vendor/bin/hw/android.hardware.audio.service.mediatek

01-01 09:00:32.176665   979   979 F DEBUG   : pid: 458, tid: 458, name: audio.service.m  >>> /vendor/bin/hw/android.hardware.audio.service.mediatek <<<

01-01 09:00:32.176754   979   979 F DEBUG   : uid: 1041

01-01 09:00:32.176821   979   979 F DEBUG   : signal 35 (<debuggerd signal>), code -1 (SI_QUEUE from pid 469, uid 1041), fault addr --------

01-01 09:00:32.176915   979   979 F DEBUG   :     r0  00000005  r1  c0306201  r2  be891060  r3  be890fa4

01-01 09:00:32.176984   979   979 F DEBUG   :     r4  ad7ed2cc  r5  c0306201  r6  be891060  r7  00000036

01-01 09:00:32.177051   979   979 F DEBUG   :     r8  ae558098  r9  ae558054  r10 ad7ed2cc  r11 be891060

01-01 09:00:32.177146   979   979 F DEBUG   :     ip  00000100  sp  be890f90  lr  ad79a2ef  pc  ad7cc4cc

01-01 09:00:32.177200   979   979 F DEBUG   : backtrace:

01-01 09:00:32.177245   979   979 F DEBUG   :       #00 pc 000994cc  /apex/com.android.runtime/lib/bionic/libc.so (__ioctl+8) (BuildId: c86be681caceaa2aa026332878d5d040)

01-01 09:00:32.177297   979   979 F DEBUG   :       #01 pc 000672eb  /apex/com.android.runtime/lib/bionic/libc.so (ioctl+26) (BuildId: c86be681caceaa2aa026332878d5d040)

01-01 09:00:32.177366   979   979 F DEBUG   :       #02 pc 0004b865  /apex/com.android.vndk.v31/lib/libhidlbase.so (android::hardware::IPCThreadState::getAndExecuteCommand()+144) (BuildId: 50f50cc38a6cdc062be70a1bbbb0bad1)

01-01 09:00:32.177435   979   979 F DEBUG   :       #03 pc 0004b735  /apex/com.android.vndk.v31/lib/libhidlbase.so (android::hardware::IPCThreadState::joinThreadPool(bool)+56) (BuildId: 50f50cc38a6cdc062be70a1bbbb0bad1)

01-01 09:00:32.177510   979   979 F DEBUG   :       #04 pc 0000247f  /vendor/bin/hw/android.hardware.audio.service.mediatek (main+1258) (BuildId: 0ea0a71621e6cca018f1f1e0d8f11973)

01-01 09:00:32.177556   979   979 F DEBUG   :       #05 pc 0005a5dd  /apex/com.android.runtime/lib/bionic/libc.so (__libc_init+56) (BuildId: c86be681caceaa2aa026332878d5d040)

01-01 09:00:32.998581   469   827 F libc    : Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 827 (TimeCheckThread), pid 469 (audioserver)

01-01 09:00:33.215847   986   986 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***


各个signal 说明

-----

sargo:/ $ kill -l

 1    HUP Hangup                        23    URG Urgent I/O condition          45     45 Signal 45

 2    INT Interrupt                     24   XCPU CPU time limit exceeded       46     46 Signal 46

 3   QUIT Quit                          25   XFSZ File size limit exceeded      47     47 Signal 47

 4    ILL Illegal instruction           26 VTALRM Virtual timer expired         48     48 Signal 48

 5   TRAP Trap                          27   PROF Profiling timer expired       49     49 Signal 49

 6   ABRT Aborted                       28  WINCH Window size changed           50     50 Signal 50

 7    BUS Bus error                     29     IO I/O possible                  51     51 Signal 51

 8    FPE Floating point exception      30    PWR Power failure                 52     52 Signal 52

 9   KILL Killed                        31    SYS Bad system call               53     53 Signal 53

10   USR1 User signal 1                 32     32 Signal 32                     54     54 Signal 54

11   SEGV Segmentation fault            33     33 Signal 33                     55     55 Signal 55

12   USR2 User signal 2                 34     34 Signal 34                     56     56 Signal 56

13   PIPE Broken pipe                   35     35 Signal 35                     57     57 Signal 57

14   ALRM Alarm clock                   36     36 Signal 36                     58     58 Signal 58

15   TERM Terminated                    37     37 Signal 37                     59     59 Signal 59

16 STKFLT Stack fault                   38     38 Signal 38                     60     60 Signal 60

17   CHLD Child exited                  39     39 Signal 39                     61     61 Signal 61

18   CONT Continue                      40     40 Signal 40                     62     62 Signal 62

19   STOP Stopped (signal)              41     41 Signal 41                     63     63 Signal 63

20   TSTP Stopped                       42     42 Signal 42                     64     64 Signal 64

21   TTIN Stopped (tty input)           43     43 Signal 43

22   TTOU Stopped (tty output)          44     44 Signal 44

sargo:/ $


评论