Eclipse 调试 - 在没有断点的情况下停止
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1668944/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Eclipse Debugging - Stopping without a breakpoint
提问by Nick Heiner
I am debugging some Java code with Eclipse 3.4.2. I have disabled all the breakpoints, yet the debugger still stops at a specific line. This point is several lines before a null pointer exception
is triggered. Curiously, when I run the same code/run configuration, but not in the debugger, the null pointer exception does not occur.
我正在使用 Eclipse 3.4.2 调试一些 Java 代码。我已经禁用了所有断点,但调试器仍然停在特定行。这个点null pointer exception
是触发a之前的几行。奇怪的是,当我运行相同的代码/运行配置但不在调试器中时,不会发生空指针异常。
Also, if I step through this code from the beginning of the method causing the null pointer exception
, using the exact same input, there is no problem. It only occurs when I remove all breakpoints but Eclipse decides to stop there regardless.
此外,如果我null pointer exception
使用完全相同的输入从导致 的方法的开头逐步执行此代码,则没有问题。它仅在我删除所有断点但 Eclipse 决定停止时发生。
Why could this be happening?
为什么会发生这种情况?
回答by Mendo
I had the same problem and finally found the following configuration option: Windows -> Preferences -> Java -> Debug -> Suspend execution on uncaught exceptions I unchecked it, and the problem disappeared. However, may be it's good to know about uncaught exceptions. I just disabled it because the problem was in Spring framework, not in my code, and hence I could correct nothing... Hope it helps :)
我遇到了同样的问题,最后找到了以下配置选项:Windows -> Preferences -> Java -> Debug -> Suspend execution on uncaught exceptions 我取消选中它,问题消失了。但是,了解未捕获的异常可能是件好事。我只是禁用了它,因为问题出在 Spring 框架中,而不是在我的代码中,因此我无法纠正任何事情......希望它有帮助 :)
回答by Aaron Digulla
Eclipse also supports exception break points (which stop your program when a certain exception is thrown). You can see them in the "Breakpoints" panel of the debugger. In your case, this could be a ClassCastException, for example.
Eclipse 还支持异常断点(在抛出某个异常时停止您的程序)。您可以在调试器的“断点”面板中看到它们。例如,在您的情况下,这可能是 ClassCastException。
If that panel is empty, then it can be a bug in your Java VM or maybe you have two processes open in the debugger. If all else fails, try to debug it in Eclipse 3.5.1.
如果该面板是空的,那么它可能是您的 Java VM 中的一个错误,或者您可能在调试器中打开了两个进程。如果一切都失败了,请尝试在 Eclipse 3.5.1 中调试它。
回答by Fortyrunner
I've encountered this as well and have yet to find a satisfactory answer. Try doing a workspace refresh, full rebuild and restart Eclipse.
我也遇到过这种情况,还没有找到满意的答案。尝试刷新工作区、完全重建并重新启动 Eclipse。
At least one of those suggestions will help.
这些建议中的至少一项会有所帮助。
Failing that - rebuild or restore your workspace (I always keep a backup)
如果失败 - 重建或恢复您的工作区(我总是保留备份)