Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

获取的堆栈中没有代码行号 #7

Open
qiquangeng opened this issue May 8, 2024 · 2 comments
Open

获取的堆栈中没有代码行号 #7

qiquangeng opened this issue May 8, 2024 · 2 comments

Comments

@qiquangeng
Copy link

qiquangeng commented May 8, 2024

获取的堆栈实际是这样(缺乏文件名和行号)

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一致呢
@Knight-ZXW
Copy link
Owner

获取的堆栈实际是这样(缺乏文件名和行号)

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等操作

可以参考系统的实现做下完善,对于分析问题来说,目前的信息应该是够的

@qiquangeng
Copy link
Author

获取的堆栈实际是这样(缺乏文件名和行号)

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等操作

可以参考系统的实现做下完善,对于分析问题来说,目前的信息应该是够的

分析问题的确足够了,不过想要把流程做完善,还是需要行号等进行自动建单,可以提高解决问题的效率,我也尝试去阅读了相关的代码,奈何本人实力有限,并不清楚行号和文件名是通过哪两个函数获取的,能麻烦您贴下么

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants