Open qiquangeng opened 6 months ago
获取的堆栈实际是这样(缺乏文件名和行号)
29944-29962 TAG com....looper.monitor.app D void java.lang.Thread.sleep(long, int) 29944-29962 TAG com....looper.monitor.app D void java.lang.Thread.sleep(long) 29944-29962 TAG com....looper.monitor.app D boolean com.netease.cloudmusic.APP.addIdleHandler$lambda-1(com.netease.cloudmusic.APP) 29944-29962 TAG com....looper.monitor.app D boolean com.netease.cloudmusic.APP.$r8$lambda$21O6vOVsLj7WDXPcCmA3Hd_TyE0(com.netease.cloudmusic.APP) 29944-29962 TAG com....looper.monitor.app D boolean com.netease.cloudmusic.APP$$ExternalSyntheticLambda1.queueIdle() 29944-29962 TAG com....looper.monitor.app D boolean com.netease.cloudmusic.looper.monitor.IdleHandlerDecorator$add$decorator$1.queueIdle() 29944-29962 TAG com....looper.monitor.app D android.os.Message android.os.MessageQueue.next()
而正常的getStackTrace格式是这样的
29209-29228 TAG com....looper.monitor.app D android.os.Looper.loopOnce(Looper.java:161) 29209-29228 TAG com....looper.monitor.app D android.os.Looper.loop(Looper.java:288) 29209-29228 TAG com....looper.monitor.app D android.app.ActivityThread.main(ActivityThread.java:7898) 29209-29228 TAG com....looper.monitor.app D java.lang.reflect.Method.invoke(Native Method) 29209-29228 TAG com....looper.monitor.app D com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) 29209-29228 TAG com....looper.monitor.app D com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936) 29209-29228 TAG com....looper.monitor.app D java.lang.Thread.sleep(Native Method) 29209-29228 TAG com....looper.monitor.app D java.lang.Thread.sleep(Thread.java:450) 29209-29228 TAG com....looper.monitor.app D java.lang.Thread.sleep(Thread.java:355) 29209-29228 TAG com....looper.monitor.app D com.netease.cloudmusic.APP.addIdleHandler$lambda-1(APP.kt:70) 29209-29228 TAG com....looper.monitor.app D com.netease.cloudmusic.APP.$r8$lambda$21O6vOVsLj7WDXPcCmA3Hd_TyE0(Unknown Source:0) 29209-29228 TAG com....looper.monitor.app D com.netease.cloudmusic.APP$$ExternalSyntheticLambda1.queueIdle(Unknown Source:2) 29209-29228 TAG com....looper.monitor.app D com.netease.cloudmusic.looper.monitor.IdleHandlerDecorator$add$decorator$1.queueIdle(IdleHandlerDecorator.kt:20)``` 如何修改可以保持和系统API一致呢
因为没有实现这部分的代码,如果需要实现这部分代码,还需要 在栈回溯的过程中获取pc等操作
可以参考系统的实现做下完善,对于分析问题来说,目前的信息应该是够的
获取的堆栈实际是这样(缺乏文件名和行号)
29944-29962 TAG com....looper.monitor.app D void java.lang.Thread.sleep(long, int) 29944-29962 TAG com....looper.monitor.app D void java.lang.Thread.sleep(long) 29944-29962 TAG com....looper.monitor.app D boolean com.netease.cloudmusic.APP.addIdleHandler$lambda-1(com.netease.cloudmusic.APP) 29944-29962 TAG com....looper.monitor.app D boolean com.netease.cloudmusic.APP.$r8$lambda$21O6vOVsLj7WDXPcCmA3Hd_TyE0(com.netease.cloudmusic.APP) 29944-29962 TAG com....looper.monitor.app D boolean com.netease.cloudmusic.APP$$ExternalSyntheticLambda1.queueIdle() 29944-29962 TAG com....looper.monitor.app D boolean com.netease.cloudmusic.looper.monitor.IdleHandlerDecorator$add$decorator$1.queueIdle() 29944-29962 TAG com....looper.monitor.app D android.os.Message android.os.MessageQueue.next()
而正常的getStackTrace格式是这样的
29209-29228 TAG com....looper.monitor.app D android.os.Looper.loopOnce(Looper.java:161) 29209-29228 TAG com....looper.monitor.app D android.os.Looper.loop(Looper.java:288) 29209-29228 TAG com....looper.monitor.app D android.app.ActivityThread.main(ActivityThread.java:7898) 29209-29228 TAG com....looper.monitor.app D java.lang.reflect.Method.invoke(Native Method) 29209-29228 TAG com....looper.monitor.app D com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) 29209-29228 TAG com....looper.monitor.app D com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936) 29209-29228 TAG com....looper.monitor.app D java.lang.Thread.sleep(Native Method) 29209-29228 TAG com....looper.monitor.app D java.lang.Thread.sleep(Thread.java:450) 29209-29228 TAG com....looper.monitor.app D java.lang.Thread.sleep(Thread.java:355) 29209-29228 TAG com....looper.monitor.app D com.netease.cloudmusic.APP.addIdleHandler$lambda-1(APP.kt:70) 29209-29228 TAG com....looper.monitor.app D com.netease.cloudmusic.APP.$r8$lambda$21O6vOVsLj7WDXPcCmA3Hd_TyE0(Unknown Source:0) 29209-29228 TAG com....looper.monitor.app D com.netease.cloudmusic.APP$$ExternalSyntheticLambda1.queueIdle(Unknown Source:2) 29209-29228 TAG com....looper.monitor.app D com.netease.cloudmusic.looper.monitor.IdleHandlerDecorator$add$decorator$1.queueIdle(IdleHandlerDecorator.kt:20)``` 如何修改可以保持和系统API一致呢
因为没有实现这部分的代码,如果需要实现这部分代码,还需要 在栈回溯的过程中获取pc等操作
可以参考系统的实现做下完善,对于分析问题来说,目前的信息应该是够的
分析问题的确足够了,不过想要把流程做完善,还是需要行号等进行自动建单,可以提高解决问题的效率,我也尝试去阅读了相关的代码,奈何本人实力有限,并不清楚行号和文件名是通过哪两个函数获取的,能麻烦您贴下么
获取的堆栈实际是这样(缺乏文件名和行号)
而正常的getStackTrace格式是这样的