日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > java >内容正文

java

java设置断点,在Java中设置断点

發布時間:2023/12/19 java 24 豆豆
生活随笔 收集整理的這篇文章主要介紹了 java设置断点,在Java中设置断点 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

How does setting breakpoints in Java work?

Is it just based on the source file name and line number? Does the class or method name also figure in?

If I have an old version of the source in my debugger and set a breakpoint, the cursor is off when I step through. How far off can it be? Can it go into the wrong method (or even the wrong class if there are more than one class in that file)?

What happens when there are multiple classes of the same name in the JVM (could happen if you have more than one classloader)? Do they all get the breakpoint?

In a web application container, can I set breakpoints for just one web application (and not the others)?

How much of this is IDE specific and how much is determined by the debugging interface that the JVM provides? For example: In Eclipse I can set conditional breakpoints based on the values of variables. Is that just filtering done by Eclipse on an unconditional breakpoint in the JVM?

解決方案

There are different kind of breakpoints. Some breakpoints are line-based, some are not. How this affects your actual debugging depends on what your IDE actually does. For example, in Eclipse, if you add a breakpoint in the middle of a method, that will be a line-based breakpoint. If you add a breakpoint on a line containing the signature of a method, that will be a method entry breakpoint.

If the source code you're looking at is not the exact source of the class that is running, a line breakpoint won't be mapped onto the right line of course. So java might not stop at the line you intended, and your IDE indeed could be showing you the wrong method or even wrong class.

But a method entry breakpoint will still work (stop at the right moment), even if the line on which the method was defined has changed; but again an IDE might show the wrong line in the debugger.

(And there are other kind of events/breakpoints too, like class loading,... You could take a look at the subinterfaces of EventRequest if you want to know more about the internals).

To answer your other question: breakpoints apply to all classloaders in the JVM.

總結

以上是生活随笔為你收集整理的java设置断点,在Java中设置断点的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。