有时,当软件监视程序或ANR跟踪没有给出哪个组件持有锁的指示时,因为其他哪些线程被阻塞或内核端被阻塞就会使设备崩溃,以上这些问题只能通过memory dump进行分析.
解决方法:
软件 watchdog 触发 memory dump.
请设置persist property"persist.sys.crashOnWatchdog"为true , 一旦发生看门狗,就会触发memory dump。
Command: adb shell setprop persist.sys.crashOnWatchdog true
[Related code snippets]
/frameworks/base/services/core/java/com/android/server/Watchdog.java
@Override
public void run() {
boolean waitedHalf = false;
while (true) {
......
boolean crashOnWatchdog = SystemProperties.getBoolean("persist.sys.crashOnWatchdog", false)
;
if (crashOnWatchdog) {
doSysRq('w');
doSysRq('l');
// wait until the above blocked threads be dumped into kernel log
SystemClock.sleep(3000);
// now try to crash the target
doSysRq('c');
}
2. ANR 触发 memory dump, please 添加如下 patch.
[Android S patch]
--
diff --git a/services/core/java/com/android/serve