Java 如何在 IntelliJ 中退一步?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/22867491/
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
How to step one step back in IntelliJ?
提问by Cristian Gutu
Is it possible to step backwards through executed code in a debug session?
是否可以在调试会话中后退执行的代码?
For example I step over a method called abc()
expecting to get 12
but after re-checking the value returned I notice it's 5
instead of 12
. How can I step back to where I was before and step into the method to see what is going on? I know you can do this in visual studio but I can't find how to do this in intelliJ.
例如,我跳过了一个名为abc()
expecting to get的方法,12
但在重新检查返回的值后,我注意到它5
不是12
. 我怎样才能回到我之前所在的位置并进入该方法以查看发生了什么?我知道你可以在 Visual Studio 中做到这一点,但我无法在 intelliJ 中找到如何做到这一点。
采纳答案by Software Engineer
You can drop the frames until you reach the point where you want to be. This isn't exactly stepping backwards, but it is quite similar in a lot of respects.
您可以丢弃帧,直到到达您想要的位置。这并不是完全倒退,但在很多方面都非常相似。
Though as Tiago mentions below this will not revert the global state of your application -- which isn't a huge concern if you're developing stateless services, but could be if you're developing swing applications (if anyone actually does that any more).
尽管正如 Tiago 在下面提到的,这不会恢复您的应用程序的全局状态——如果您正在开发无状态服务,这不是一个大问题,但如果您正在开发摆动应用程序(如果有人真的这样做了) )。
On the debugger toolbar it looks like this: . In
Idea 2016.3
and later the drop-frame icon looks like this
在调试工具栏,它看起来是这样的:。在
Idea 2016.3
以后的丢帧图标看起来像这样
Full documentation is available here: IntelliJ Debugger Docs, and there is a StackOverflow Drop Frame Question, with a few useful answers
完整文档可在此处获得:IntelliJ Debugger Docs,还有一个StackOverflow Drop Frame Question,有一些有用的答案
回答by tales
Check out Chronon Debugger plugin which actually allows you to step back, not just drop the frame http://blog.jetbrains.com/idea/2014/03/try-chronon-debugger-with-intellij-idea-13-1-eap/
查看 Chronon Debugger 插件,它实际上允许您退后一步,而不仅仅是放弃框架 http://blog.jetbrains.com/idea/2014/03/try-chronon-debugger-with-intellij-idea-13-1-伊普/