-
Notifications
You must be signed in to change notification settings - Fork 344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Breakpoint on outer loop won't stop when using Resume (F5) after breaking once #1407
Comments
@LeducNic I cannot reproduce it. See the screenshot below: bug_1407.mp4 |
Do you use Oracle JDK or OpenJDK? |
Hello, I installed Oracle JDK 17.0.9 on a clean Windows 10 VM with VSCode 1.84.2 (user) and Java Extension Pack. I created a new text file named At09Ex05.java in my home directory and copied the main() as above. I don't use any project manager (like Maven) for my Java code. With only one breackpoint the code doesn't stop after reaching the breackpoint once. After that, I have put three breakpoints and you can see that only the last two breakpoints are working correctly. Can you give me more infos about your configuration? Thank you very much for your help Win10-Test-screen.mp4 |
@LeducNic thanks for the information. The screenshot I shared is based on a gradle project, which delegates the build to the javac and the outer loop breakpoint works well. And then I tried it with a no buildtool folder again, I can reproduce it. The no buildtool project will use the built-in compiler (ECJ) in Java language server to compile java files. Looks like the ECJ result is somehow different with javac. Anyway, I see the final running result is not affected, just the outer loop breakpoint is somehow broken in the ECJ case. |
Thanks. Do you know if it is possible to use javac to compile the source when running/debugging with no build tools? |
This requires a change in the infrastructure to use Javac instead of ECJ, which is a big decision that we need to evaluate more. At the moment we need to investigate this issue further to see if it's a common or corner case. |
After some experimentation, I have found that the java assembly code generated for the loops by ECJ and javac are different. The ECJ code won't debug correctly with jdb, but the javac code work fine. Also, even the Eclipse debugger don't work correctly with the loops because the first press on continue won't do anything but after that Eclipse stop after each loop correctly. So maybe ECJ needs to generate code like javac for the loops? |
When you put a breakpoint on a outer while loop in a method, the debugger break only once instead of for each loop executed. Also, a loop in a if won't work correctly. But if you have an inner loop (loop in a loop), the breakpoint work as expected, so the debugger break after each execution of the inner loop.
Environment
Steps To Reproduce
Using this code:
package sandbox;
public class At09Ex05 {
public static void main(String[] args) {
int nb1, nb2, som1, som2;
}
Current Result
The program run until the end when using F5 on the outer loop
Expected Result
Since the loop should execute a few times, Resume (F5) should stop again at the breakpoint after executing the loop.
Additional Informations
If you do the same test with a brepoint on the while (som1 < som2) { , the behaviour is correct.
If you change while (som1 != som2) { for if (som1 != som2) { then the two inner loops have the problem.
The text was updated successfully, but these errors were encountered: