SWT/ANR问题--当发送ANR/SWT时候如何打开binder trace(BinderTraces)

澹台正业
2023-12-01

问题描述:

由于绑定事务,我们经常遇到一些系统看门狗(或ANR)问题。 此时,在获得绑定器跟踪日志后,对我们分析问题非常有帮助。  

在本文档中,我们介绍如何在发生看门狗(或ANR)时启用绑定跟踪(BinderTraces)日志。 

解决方案: 

 1. 当ANR发生时,文件名为“BinderTraces_pid__.txt”

2. 当发生WATCHDOG时,文件名是为“BinderTraces_pid_.txt”

3. Patches:

1) diff --git a/services/core/java/com/android/server/Watchdog.java
b/services/core/java/com/android/server/Watchdog.java
index c04c2ac..0f58746 100644
--- a/services/core/java/com/android/server/Watchdog.java
+++ b/services/core/java/com/android/server/Watchdog.java
@@ -515,7 +515,7 @@ public class Watchdog extends Thread {
//Collect Binder State logs to get status of all the transactions
if (Build.IS_DEBUGGABLE) { //Note: the "ro.debuggable" system property must be set to
"1", then the binder trace log will be enabled
- binderStateRead();
+ binderStateRead(String.valueOf(Process.myPi
 类似资料: