Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to skip loops while debugging Java code?

Tags:

This is not a duplicate of How to come out of while loop during debugging. See the comment on this answer https://stackoverflow.com/a/8107702/1391924 by the author of this question.

While debugging, we can use short-cut keys like F8 to resume, F7 to step return, F5 to step into, F6 to step over.

Is there any short-cut key to skip loops (for,while and do-while) while debugging Java code?

In the picture shown below

enter image description here 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 (i.e excluding comments. Here line no 64). And when again pressed this key it should come to line number 66.

Edit:

Not got any satisfied answer. Raised a bug here. Please vote up and request this feature in next JDT release.

like image 500
Chandrayya G K Avatar asked Dec 10 '13 10:12

Chandrayya G K


People also ask

How do I skip a loop while debugging?

You can add a breakpoint after the loop and click F8 (resume). The debugger will stop on the next found breakpoint, e.g. you will have skipped the loop(s).

How do you debug code in Java?

A Java program can be debugged simply by right clicking on the Java editor class file from Package explorer. Select Debug As → Java Application or use the shortcut Alt + Shift + D, J instead.

How do you exit a loop in GDB?

Like you can cancel a program on the command line, GDB lets you use ctrl-c to stop a program wherever it currently is. Hit ctrl-c now to break the infinite loop.


1 Answers

Select the line that's out of the loop and press ctrl + r (Run to line):

enter image description here

like image 86
Maroun Avatar answered Oct 25 '22 17:10

Maroun