简体   繁体   English

如何在调试Java代码时跳过循环?

[英]How to skip loops while debugging Java code?

This is not a duplicate of How to come out of while loop during debugging . 这不是如何在调试期间退出while循环的重复。 See the comment on this answer https://stackoverflow.com/a/8107702/1391924 by the author of this question. 请参阅此问题的作者对此答案的评论https://stackoverflow.com/a/8107702/1391924

While debugging, we can use short-cut keys like F8 to resume, F7 to step return, F5 to step into, F6 to step over. 在调试时,我们可以使用F8等快捷键恢复, F7步进返回, F5步进, F6步进。

Is there any short-cut key to skip loops (for,while and do-while) while debugging Java code? 调试Java代码时是否有任何快捷键可以跳过循环(for,while和do-while)?

In the picture shown below 在下图所示的图片中

在此输入图像描述 Currently debug cursor is at line no 57. Is there any short cut key when pressed it debug cursor should come out of innermost loop (for,while or do-while. Here while loop) and pause at next executable statement (ie excluding comments. Here line no 64). 当前调试光标位于第57行。按下它时是否有任何快捷键调试光标应该从最里面的循环中出来(for,while或do-while。这里是while循环)并在下一个可执行语句处暂停(即排除注释。这里没有64号线。 And when again pressed this key it should come to line number 66. 当再次按下此键时,它应该到第66行。

Edit: 编辑:

Not got any satisfied answer. 没有得到任何满意的答案。 Raised a bug here . 在这里提出了一个错误。 Please vote up and request this feature in next JDT release. 请在下一个JDT版本中投票并请求此功能。

Select the line that's out of the loop and press ctrl + r (Run to line): 选择不在循环中的行,然后按ctrl + r (运行到行):

在此输入图像描述

You can add a breakpoint after the loop and click F8 (resume). 您可以在循环后添加断点,然后单击F8 (继续)。 The debugger will stop on the next found breakpoint, eg you will have skipped the loop(s). 调试器将在下一个找到的断点处停止,例如,您将跳过循环。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM