Skip to content

Commit

Permalink
jdi tests: more logoutput for missing ClassPrepareEvent in I-builds
Browse files Browse the repository at this point in the history
  • Loading branch information
EcljpseB0T committed Sep 12, 2024
1 parent 8c1b934 commit bf5ba53
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1308,8 +1308,7 @@ protected void startProgram() {
Event event = waitForEvent(waiter, TIMEOUT);
fEventReader.removeEventListener(waiter);
if (event == null) {
System.out.println(
"\nThe program doesn't seem to have started after " + TIMEOUT + "ms");
throw new RuntimeException("ClassPrepareEvent for " + getMainClassName() + " missing after " + TIMEOUT + "ms");
}
// silence streams after "Listening for transport dt_socket at address: xyz"
if (fConsoleErrorReader instanceof NullConsoleReader r) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ public void start() {
fReaderThread = new Thread(new Runnable() {
@Override
public void run() {
readerLoop();
try {
readerLoop();
} catch (Throwable e) {
e.printStackTrace();
}
}
}, fName);
fReaderThread.setDaemon(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,33 +63,47 @@ public synchronized void addEventListener(EventListener listener) {
* Returns whether the VM should be resumed.
*/
private boolean dispath(Event event, EventListener listener) {
if (event instanceof AccessWatchpointEvent)
System.out.println(event);
if (event instanceof AccessWatchpointEvent) {
return listener.accessWatchpoint((AccessWatchpointEvent) event);
if (event instanceof BreakpointEvent)
}
if (event instanceof BreakpointEvent) {
return listener.breakpoint((BreakpointEvent) event);
if (event instanceof ClassPrepareEvent)
}
if (event instanceof ClassPrepareEvent) {
return listener.classPrepare((ClassPrepareEvent) event);
if (event instanceof ClassUnloadEvent)
}
if (event instanceof ClassUnloadEvent) {
return listener.classUnload((ClassUnloadEvent) event);
if (event instanceof ExceptionEvent)
}
if (event instanceof ExceptionEvent) {
return listener.exception((ExceptionEvent) event);
if (event instanceof MethodEntryEvent)
}
if (event instanceof MethodEntryEvent) {
return listener.methodEntry((MethodEntryEvent) event);
if (event instanceof MethodExitEvent)
}
if (event instanceof MethodExitEvent) {
return listener.methodExit((MethodExitEvent) event);
if (event instanceof ModificationWatchpointEvent)
}
if (event instanceof ModificationWatchpointEvent) {
return listener.modificationWatchpoint(
(ModificationWatchpointEvent) event);
if (event instanceof StepEvent)
}
if (event instanceof StepEvent) {
return listener.step((StepEvent) event);
if (event instanceof ThreadDeathEvent)
}
if (event instanceof ThreadDeathEvent) {
return listener.threadDeath((ThreadDeathEvent) event);
if (event instanceof ThreadStartEvent)
}
if (event instanceof ThreadStartEvent) {
return listener.threadStart((ThreadStartEvent) event);
if (event instanceof VMDisconnectEvent)
}
if (event instanceof VMDisconnectEvent) {
return listener.vmDisconnect((VMDisconnectEvent) event);
if (event instanceof VMDeathEvent)
}
if (event instanceof VMDeathEvent) {
return listener.vmDeath((VMDeathEvent) event);
}
return true;
}
/**
Expand All @@ -113,25 +127,28 @@ protected void readerLoop() {
fEventListeners.elementAt(i);
shouldGo = shouldGo & dispath(event, listener);
}
if (event instanceof VMDeathEvent)
if (event instanceof VMDeathEvent) {
stop();
}
}

// Let the VM go if it was interrupted
if ((!fIsStopping)
&& (eventSet != null)
&& (eventSet.suspendPolicy() == EventRequest.SUSPEND_ALL)
&& shouldGo)
&& shouldGo) {
synchronized (this) {
fEventQueue.virtualMachine().resume();
}
}
}
} catch (InterruptedException e) {
if (!fIsStopping) {
System.out.println("Event reader loop was interrupted");
return;
}
} catch (VMDisconnectedException e) {
e.printStackTrace();
return;
}
}
Expand Down

0 comments on commit bf5ba53

Please sign in to comment.