| Summary: | Stepping over a line of code that throws NPE causes the debugger to lose it's way | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Bryan Hunt <bhunt> | ||||
| Component: | Debug | Assignee: | JDT-Debug-Inbox <jdt-debug-inbox> | ||||
| Status: | CLOSED WONTFIX | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | darin.eclipse | ||||
| Version: | 3.5 | ||||||
| Target Milestone: | --- | ||||||
| Hardware: | PC | ||||||
| OS: | Mac OS X | ||||||
| Whiteboard: | stalebug | ||||||
| Attachments: |
|
||||||
|
Description
Bryan Hunt
Appears to be a regression since 3.4 Actually, there is no regression here - behavior depends on how the "Java > Debug > Suspend execution on uncaught exception" preference is set (and is the same in 3.4). When *on*, execution suspends when stepping. When *off* execution resumes when stepping over the NPE. There is a bug here however. The user is stepping, so execution should not resume out from under them. FYI, Suspend execution on uncaught exceptions is checked in my dev env. It also seems to be VM sensitive. For example, using Sun Java 6, stepping over an NPE with the option to suspend on exceptions *off*, I end up in the method "java.lang.Thread.dispatchUncaughtException(Throwable) line: 1821". Using Java 5, execution is resumed. On Java 6, a step end event is sent via JDWP, but on Java 5, the event is not present - instead there is a thread death event.
If the step event is not produced by the VM, there is nothing we can do about this. Will test on Mac, to see what happens (this is Win XP).
Java 6 trace (where step over does complete)
JDI Event Set: {VMStartEvent: 0}
JDI Event Set: {ThreadStartEvent: 3}
JDI Event Set: {ClassPrepareEvent: 9}
JDI Event Set: {BreakpointEvent: 20}
JDI Event Set: {StepEvent: 21}
JDI Event Set: {StepEvent: 22}
Java 5 trace (where step over does not complete)
JDI Event Set: {VMStartEvent: 0}
JDI Event Set: {ThreadStartEvent: 3}
JDI Event Set: {ThreadStartEvent: 3}
JDI Event Set: {ClassPrepareEvent: 9}
JDI Event Set: {BreakpointEvent: 20}
JDI Event Set: {StepEvent: 21}
JDI Event Set: {ThreadDeathEvent: 4}
This also works for me on Mac. When the preference to suspend on uncaught exceptions is on, stepping stops when the exception is hit, with the following event trace:
JDI Event Set: {VMStartEvent: 0}
JDI Event Set: {ThreadStartEvent: 3}
JDI Event Set: {ThreadStartEvent: 3}
JDI Event Set: {ClassPrepareEvent: 5}
JDI Event Set: {BreakpointEvent: 13}
JDI Event Set: {StepEvent: 14}
JDI Event Set: {ExceptionEvent: 12}
When the preference is off, stepping resumes as there is no step end event - just a thread death event.
JDI Event Set: {VMStartEvent: 0}
JDI Event Set: {ThreadStartEvent: 3}
JDI Event Set: {ThreadStartEvent: 3}
JDI Event Set: {ClassPrepareEvent: 5}
JDI Event Set: {BreakpointEvent: 10}
JDI Event Set: {StepEvent: 11}
JDI Event Set: {ThreadDeathEvent: 4}
So that means you can't repo the problem? Created attachment 136402 [details]
movie showing the problem
I cannot reproduce. Does it happen with a simple program like this:
public class StepOverNPE implements Runnable {
public static void main(String[] args) {
StepOverNPE overNPE = new StepOverNPE();
Thread thread = new Thread(overNPE);
thread.start();
System.out.println("yay"); // BREAKPOINT
}
/* (non-Javadoc)
* @see java.lang.Runnable#run()
*/
public void run() {
Iterator<String> it = null; // BREAKPOINT & STEP
while (it.hasNext()) {
String string = (String) it.next();
System.out.println(string);
}
}
}
I cannot reproduce the problem with your simple test program. I even tried wrapping the code in a plugin and it properly suspends on the NPE This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug. If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie. |