我有一个非常奇怪的问题。 我正在 Eclipse 中开发 Java SWING 应用程序。我在我的代码中的某处设置了一个断点,然后运行调试。我执行了一段包含断点的代码,但它总是被跳过。 一旦我运行了一些抛出未捕获异常的代码,断点就开始再次命中,而没有改变任何其他东西。抛出异常的代码和包含断点的代码没有关系。
我尝试在几个地方设置断点,但在抛出异常之前它们永远不会被击中。 我只对这个特定的应用程序有这个问题。我的调试器适用于其他 SWING 应用程序。
你能想到造成这种情况的任何原因吗?
最佳答案
您运行的是什么版本的 Eclipse 和 Java?
你知道this question吗? ? ( bug 279137 : 在 JDK 1.6.0_14 下无法命中断点)
作为gojomo评论中的评论,该错误 (279137) 现在(2009 年 7 月 21 日)提到:
The bug is now visible in the sun bug database: bug 6862295.
We have listed a workaround for this problem, which can be used while we investigate a fix for the bug.
Work Around
Using the option
-XX:+UseParallelGC
makes the failure not reproducible with either the Client VM or the Server VM.
(选项哟添加到 eclipse.ini )
I would recommend that you use the 'watch this bug' feature, so you can be notified when there are updates to the bug. Here is the link to watch this specific bug
固定
作为release note of the jdk6_u16 (2009 年 8 月下旬)提到,该错误已修复
Bug fixed in this release:
6862295 JDWP threadid changes during debugging session (leading to ignored breakpoints)
关于java - Eclipse SWING 应用程序 : breakpoint hit only after an uncaught exception is thrown,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1027002/