android debugger - what is the relation between frame and thread? Does breakpoint work differently in different places?

試著忘記壹切 提交于 2020-01-24 20:47:30

问题


I’m confused by the Debugger. It seems to pause the app and show the Debug window for some breakpoints and not for other breakpoints. It still ticks the breakpoints, though it doesn’t pause the app. And when I open the Debug window I see no frame so I couldn’t look at variables. I’ve looked at many documents and they haven’t cleared my problem. So what I’d like to know are:

  • how frame and thread are related
  • does breakpoint work differently in different place or different class in the app?

回答1:


As it seems the Guide provided by Google doesn't answer your question, I will add an extra explanation, hope it helps:

1- The Frame is directly related to application process which can be consisted of multiple thread used by application, means that as long as application process is up and running the frame is available too.

However this doesn't mean that you can watch variables whenever you want, the Variables window frame become available once the debugger hits a breakpoint.

2- Yes, for the debugger to hit a breakpoint few criteria should be met. It's a long list but here is the more important ones:

  1. App must be debuggable in the first place, if the app is defined as not debuggable (like release builds) then the debugger won't work.
  2. The code must be readable hence executable to debugger, that means codes that are obfuscated or tampered with won't cause the debugger to stop at breakpoints..
  3. Code must be executable, that means codes that aren't executable like variable declaration or codes that are unreachable won't cause debugger to stop.

P.S: Of course these are only few major causes and there are lots of others like instant run that can make a piece of code undebuggable.



来源:https://stackoverflow.com/questions/50093961/android-debugger-what-is-the-relation-between-frame-and-thread-does-breakpoin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!