When a program is suspended on a thrown exception and we pop some frames off the stack, subsequent stepping is not reliable.
Steps to reproduce:
1) Compile the attached program
2) In one terminal run:
java -Xdebug -Xrunjdwp:transport=dt_socket,address=localhost:8888,server=y,suspend=y -classpath build/classes test.BadStepTest
3) In a second terminal run:
jdb -attach 8888
main[1] catch java.lang.NullPointerException
main[1] cont
the program is suspended on an exception: java.lang.NullPointerException
Then do:
main[1] pop
main[1] pop
main[1] step
main[1] next
main[1] next
> Step completed: "thread=main", test.BadStepTest.startTest(), line=24 bci=4
main[1] next
> Step completed: "thread=main", test.BadStepTest.startTest(), line=28 bci=49
Please note that instead of stepping to line 25, program stops at the finally block at line 28. This is unexpected, since user wants to be able to step to the point where the exception was thrown.
We have a real use-case that suffers from this bug at https://netbeans.org/bugzilla/show_bug.cgi?id=188962
Please note that stepping via "step" (Step Into) is possible. Via "next" (Step Over) it's not.
|