Index: jdi/org/eclipse/jdi/internal/VirtualMachineImpl.java =================================================================== retrieving revision 1.25 diff -u -r1.25 VirtualMachineImpl.java --- jdi/org/eclipse/jdi/internal/VirtualMachineImpl.java 16 Jun 2003 20:00:14 -0000 1.25 +++ jdi/org/eclipse/jdi/internal/VirtualMachineImpl.java 20 Mar 2004 22:39:19 -0000 @@ -842,6 +842,13 @@ fJdwpMinorVersion = readInt("minor version", replyData); //$NON-NLS-1$ fVMVersion = readString("version", replyData); //$NON-NLS-1$ fVMName = readString("name", replyData); //$NON-NLS-1$ + + if ((fVMName != null) && fVMName.equals("KVM")) { + // KVM requires class preparation events in order + // to resolve things correctly + eventRequestManagerImpl().enableInternalClassPrepareEvent(); + } + } catch (IOException e) { fVersionDescription = null; defaultIOExceptionHandler(e); Index: jdi/org/eclipse/jdi/internal/request/EventRequestManagerImpl.java =================================================================== retrieving revision 1.14 diff -u -r1.14 EventRequestManagerImpl.java --- jdi/org/eclipse/jdi/internal/request/EventRequestManagerImpl.java 14 Aug 2003 16:55:56 -0000 1.14 +++ jdi/org/eclipse/jdi/internal/request/EventRequestManagerImpl.java 20 Mar 2004 22:39:22 -0000 @@ -239,7 +239,24 @@ addEventRequest(STEP_INDEX, req); return req; } + + /** + * Enables class prepare requests for all loaded classes. This is + * necessary for current versions of the KVM to function correctly. + * This method is only called when the remote VM is determined to be + * the KVM. + */ + public void enableInternalClassPrepareEvent() { + // Note that these requests are not stored in the set of outstanding requests because + // they must be invisible from outside. + ClassPrepareRequestImpl requestPrepare = + new ClassPrepareRequestImpl(virtualMachineImpl()); + requestPrepare.setGeneratedInside(); + requestPrepare.setSuspendPolicy(ClassPrepareRequest.SUSPEND_NONE); + requestPrepare.enable(); + } + /** * Creates ClassUnloadRequest for maintaining class information for within JDI. * Needed to known when to flush the cache.