com.sun.jdi.request.BreakpointRequest Java Examples
The following examples show how to use
com.sun.jdi.request.BreakpointRequest.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ThreadReferenceImpl.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
public boolean isAtBreakpoint() { /* * TO DO: This fails to take filters into account. */ try { StackFrame frame = frame(0); Location location = frame.location(); List<BreakpointRequest> requests = vm.eventRequestManager().breakpointRequests(); Iterator<BreakpointRequest> iter = requests.iterator(); while (iter.hasNext()) { BreakpointRequest request = iter.next(); if (location.equals(request.location())) { return true; } } return false; } catch (IndexOutOfBoundsException iobe) { return false; // no frames on stack => not at breakpoint } catch (IncompatibleThreadStateException itse) { // Per the javadoc, not suspended => return false return false; } }
Example #2
Source File: ThreadReferenceImpl.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
public boolean isAtBreakpoint() { /* * TO DO: This fails to take filters into account. */ try { StackFrame frame = frame(0); Location location = frame.location(); List<BreakpointRequest> requests = vm.eventRequestManager().breakpointRequests(); Iterator<BreakpointRequest> iter = requests.iterator(); while (iter.hasNext()) { BreakpointRequest request = iter.next(); if (location.equals(request.location())) { return true; } } return false; } catch (IndexOutOfBoundsException iobe) { return false; // no frames on stack => not at breakpoint } catch (IncompatibleThreadStateException itse) { // Per the javadoc, not suspended => return false return false; } }
Example #3
Source File: ThreadReferenceImpl.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public boolean isAtBreakpoint() { /* * TO DO: This fails to take filters into account. */ try { StackFrame frame = frame(0); Location location = frame.location(); List<BreakpointRequest> requests = vm.eventRequestManager().breakpointRequests(); Iterator<BreakpointRequest> iter = requests.iterator(); while (iter.hasNext()) { BreakpointRequest request = iter.next(); if (location.equals(request.location())) { return true; } } return false; } catch (IndexOutOfBoundsException iobe) { return false; // no frames on stack => not at breakpoint } catch (IncompatibleThreadStateException itse) { // Per the javadoc, not suspended => return false return false; } }
Example #4
Source File: ThreadReferenceImpl.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public boolean isAtBreakpoint() { /* * TO DO: This fails to take filters into account. */ try { StackFrame frame = frame(0); Location location = frame.location(); List<BreakpointRequest> requests = vm.eventRequestManager().breakpointRequests(); Iterator<BreakpointRequest> iter = requests.iterator(); while (iter.hasNext()) { BreakpointRequest request = iter.next(); if (location.equals(request.location())) { return true; } } return false; } catch (IndexOutOfBoundsException iobe) { return false; // no frames on stack => not at breakpoint } catch (IncompatibleThreadStateException itse) { // Per the javadoc, not suspended => return false return false; } }
Example #5
Source File: ThreadReferenceImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public boolean isAtBreakpoint() { /* * TO DO: This fails to take filters into account. */ try { StackFrame frame = frame(0); Location location = frame.location(); List<BreakpointRequest> requests = vm.eventRequestManager().breakpointRequests(); Iterator<BreakpointRequest> iter = requests.iterator(); while (iter.hasNext()) { BreakpointRequest request = iter.next(); if (location.equals(request.location())) { return true; } } return false; } catch (IndexOutOfBoundsException iobe) { return false; // no frames on stack => not at breakpoint } catch (IncompatibleThreadStateException itse) { // Per the javadoc, not suspended => return false return false; } }
Example #6
Source File: GetObjectLockCount.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
private static void addBreakpoint(VirtualMachine vm, ReferenceType refType) { Location breakpointLocation = null; List<Location> locs; try { locs = refType.allLineLocations(); for (Location loc: locs) { if (loc.method().name().equals(METHOD_NAME)) { breakpointLocation = loc; break; } } } catch (AbsentInformationException e) { // TODO Auto-generated catch block e.printStackTrace(); } if (breakpointLocation != null) { EventRequestManager evtReqMgr = vm.eventRequestManager(); BreakpointRequest bReq = evtReqMgr.createBreakpointRequest(breakpointLocation); bReq.setSuspendPolicy(BreakpointRequest.SUSPEND_ALL); bReq.enable(); } }
Example #7
Source File: ThreadReferenceImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
public boolean isAtBreakpoint() { /* * TO DO: This fails to take filters into account. */ try { StackFrame frame = frame(0); Location location = frame.location(); List<BreakpointRequest> requests = vm.eventRequestManager().breakpointRequests(); Iterator<BreakpointRequest> iter = requests.iterator(); while (iter.hasNext()) { BreakpointRequest request = iter.next(); if (location.equals(request.location())) { return true; } } return false; } catch (IndexOutOfBoundsException iobe) { return false; // no frames on stack => not at breakpoint } catch (IncompatibleThreadStateException itse) { // Per the javadoc, not suspended => return false return false; } }
Example #8
Source File: ThreadReferenceImpl.java From hottub with GNU General Public License v2.0 | 6 votes |
public boolean isAtBreakpoint() { /* * TO DO: This fails to take filters into account. */ try { StackFrame frame = frame(0); Location location = frame.location(); List<BreakpointRequest> requests = vm.eventRequestManager().breakpointRequests(); Iterator<BreakpointRequest> iter = requests.iterator(); while (iter.hasNext()) { BreakpointRequest request = iter.next(); if (location.equals(request.location())) { return true; } } return false; } catch (IndexOutOfBoundsException iobe) { return false; // no frames on stack => not at breakpoint } catch (IncompatibleThreadStateException itse) { // Per the javadoc, not suspended => return false return false; } }
Example #9
Source File: JPDAThreadImpl.java From netbeans with Apache License 2.0 | 6 votes |
private void submitCheckForMonitorEntered(ObjectReference waitingMonitor) throws InternalExceptionWrapper, VMDisconnectedExceptionWrapper, ObjectCollectedExceptionWrapper, IllegalThreadStateExceptionWrapper { try { ThreadReferenceWrapper.suspend(threadReference); logger.fine("submitCheckForMonitorEntered(): suspending "+threadName); ObjectReference monitor = ThreadReferenceWrapper.currentContendedMonitor(threadReference); if (monitor == null) return ; Location loc = StackFrameWrapper.location(ThreadReferenceWrapper.frame(threadReference, 0)); loc = MethodWrapper.locationOfCodeIndex(LocationWrapper.method(loc), LocationWrapper.codeIndex(loc) + 1); if (loc == null) return; BreakpointRequest br = EventRequestManagerWrapper.createBreakpointRequest( VirtualMachineWrapper.eventRequestManager(MirrorWrapper.virtualMachine(threadReference)), loc); BreakpointRequestWrapper.addThreadFilter(br, threadReference); submitMonitorEnteredRequest(br); } catch (IncompatibleThreadStateException itex) { Exceptions.printStackTrace(itex); } catch (InvalidStackFrameExceptionWrapper isex) { Exceptions.printStackTrace(isex); } finally { logger.fine("submitCheckForMonitorEntered(): resuming "+threadName); ThreadReferenceWrapper.resume(threadReference); } }
Example #10
Source File: ThreadReferenceImpl.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
public boolean isAtBreakpoint() { /* * TO DO: This fails to take filters into account. */ try { StackFrame frame = frame(0); Location location = frame.location(); List<BreakpointRequest> requests = vm.eventRequestManager().breakpointRequests(); Iterator<BreakpointRequest> iter = requests.iterator(); while (iter.hasNext()) { BreakpointRequest request = iter.next(); if (location.equals(request.location())) { return true; } } return false; } catch (IndexOutOfBoundsException iobe) { return false; // no frames on stack => not at breakpoint } catch (IncompatibleThreadStateException itse) { // Per the javadoc, not suspended => return false return false; } }
Example #11
Source File: ThreadReferenceImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public boolean isAtBreakpoint() { /* * TO DO: This fails to take filters into account. */ try { StackFrame frame = frame(0); Location location = frame.location(); List<BreakpointRequest> requests = vm.eventRequestManager().breakpointRequests(); Iterator<BreakpointRequest> iter = requests.iterator(); while (iter.hasNext()) { BreakpointRequest request = iter.next(); if (location.equals(request.location())) { return true; } } return false; } catch (IndexOutOfBoundsException iobe) { return false; // no frames on stack => not at breakpoint } catch (IncompatibleThreadStateException itse) { // Per the javadoc, not suspended => return false return false; } }
Example #12
Source File: ThreadReferenceImpl.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
public boolean isAtBreakpoint() { /* * TO DO: This fails to take filters into account. */ try { StackFrame frame = frame(0); Location location = frame.location(); List<BreakpointRequest> requests = vm.eventRequestManager().breakpointRequests(); Iterator<BreakpointRequest> iter = requests.iterator(); while (iter.hasNext()) { BreakpointRequest request = iter.next(); if (location.equals(request.location())) { return true; } } return false; } catch (IndexOutOfBoundsException iobe) { return false; // no frames on stack => not at breakpoint } catch (IncompatibleThreadStateException itse) { // Per the javadoc, not suspended => return false return false; } }
Example #13
Source File: ThreadReferenceImpl.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
public boolean isAtBreakpoint() { /* * TO DO: This fails to take filters into account. */ try { StackFrame frame = frame(0); Location location = frame.location(); List<BreakpointRequest> requests = vm.eventRequestManager().breakpointRequests(); Iterator<BreakpointRequest> iter = requests.iterator(); while (iter.hasNext()) { BreakpointRequest request = iter.next(); if (location.equals(request.location())) { return true; } } return false; } catch (IndexOutOfBoundsException iobe) { return false; // no frames on stack => not at breakpoint } catch (IncompatibleThreadStateException itse) { // Per the javadoc, not suspended => return false return false; } }
Example #14
Source File: ThreadReferenceImpl.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
public boolean isAtBreakpoint() { /* * TO DO: This fails to take filters into account. */ try { StackFrame frame = frame(0); Location location = frame.location(); List<BreakpointRequest> requests = vm.eventRequestManager().breakpointRequests(); Iterator<BreakpointRequest> iter = requests.iterator(); while (iter.hasNext()) { BreakpointRequest request = iter.next(); if (location.equals(request.location())) { return true; } } return false; } catch (IndexOutOfBoundsException iobe) { return false; // no frames on stack => not at breakpoint } catch (IncompatibleThreadStateException itse) { // Per the javadoc, not suspended => return false return false; } }
Example #15
Source File: ThreadReferenceImpl.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public boolean isAtBreakpoint() { /* * TO DO: This fails to take filters into account. */ try { StackFrame frame = frame(0); Location location = frame.location(); List<BreakpointRequest> requests = vm.eventRequestManager().breakpointRequests(); Iterator<BreakpointRequest> iter = requests.iterator(); while (iter.hasNext()) { BreakpointRequest request = iter.next(); if (location.equals(request.location())) { return true; } } return false; } catch (IndexOutOfBoundsException iobe) { return false; // no frames on stack => not at breakpoint } catch (IncompatibleThreadStateException itse) { // Per the javadoc, not suspended => return false return false; } }
Example #16
Source File: DynamothDataCollector.java From nopol with GNU General Public License v2.0 | 5 votes |
private void disableEventRequest() { List<BreakpointRequest> breakpoint = threadRef.virtualMachine().eventRequestManager().breakpointRequests(); for (int j = 0; j < breakpoint.size(); j++) { BreakpointRequest breakpointRequest = breakpoint.get(j); breakpointRequest.setEnabled(false); } }
Example #17
Source File: DynamothDataCollector.java From nopol with GNU General Public License v2.0 | 5 votes |
private void enableEventRequest() { List<BreakpointRequest> breakpoint = threadRef.virtualMachine().eventRequestManager().breakpointRequests(); for (int j = 0; j < breakpoint.size(); j++) { BreakpointRequest breakpointRequest = breakpoint.get(j); breakpointRequest.setEnabled(true); } }
Example #18
Source File: Breakpoint.java From java-debug with Eclipse Public License 1.0 | 5 votes |
@Override public void setHitCount(int hitCount) { this.hitCount = hitCount; Observable.fromIterable(this.requests()) .filter(request -> request instanceof BreakpointRequest) .subscribe(request -> { request.addCountFilter(hitCount); request.enable(); }); }
Example #19
Source File: JDIExampleDebugger.java From tutorials with MIT License | 5 votes |
/** * Sets the break points at the line numbers mentioned in breakPointLines array * @param vm * @param event * @throws AbsentInformationException */ public void setBreakPoints(VirtualMachine vm, ClassPrepareEvent event) throws AbsentInformationException { ClassType classType = (ClassType) event.referenceType(); for(int lineNumber: breakPointLines) { Location location = classType.locationsOfLine(lineNumber).get(0); BreakpointRequest bpReq = vm.eventRequestManager().createBreakpointRequest(location); bpReq.enable(); } }
Example #20
Source File: LineBreakpointImpl.java From netbeans with Apache License 2.0 | 5 votes |
private void setFilters(BreakpointRequest br) throws InternalExceptionWrapper, VMDisconnectedExceptionWrapper { JPDAThread[] threadFilters = getBreakpoint().getThreadFilters(getDebugger()); if (threadFilters != null && threadFilters.length > 0) { for (JPDAThread t : threadFilters) { BreakpointRequestWrapper.addThreadFilter(br, ((JPDAThreadImpl) t).getThreadReference()); } } ObjectVariable[] varFilters = getBreakpoint().getInstanceFilters(getDebugger()); if (varFilters != null && varFilters.length > 0) { for (ObjectVariable v : varFilters) { BreakpointRequestWrapper.addInstanceFilter(br, (ObjectReference) ((JDIVariable) v).getJDIValue()); } } }
Example #21
Source File: LineBreakpointImpl.java From netbeans with Apache License 2.0 | 5 votes |
@Override protected EventRequest createEventRequest(EventRequest oldRequest) throws InternalExceptionWrapper, VMDisconnectedExceptionWrapper { Location location = BreakpointRequestWrapper.location((BreakpointRequest) oldRequest); BreakpointRequest br = EventRequestManagerWrapper.createBreakpointRequest(getEventRequestManager(), location); setFilters(br); return br; }
Example #22
Source File: LineBreakpointImpl.java From netbeans with Apache License 2.0 | 5 votes |
/** * Checks whether the list of reference types are new types (the breakpoint * was not submitted anywhere yet), or are some of the types for which the * breakpoint was submitted already. * @param referenceTypes The types to check */ private boolean areNewOrSubmittedTypes(List<ReferenceType> referenceTypes) { List<EventRequest> eventRequests = getEventRequests(); List<BreakpointRequest> brs = new LinkedList<BreakpointRequest>(); for (EventRequest er : eventRequests) { if (er instanceof BreakpointRequest) { brs.add((BreakpointRequest) er); } } if (brs.isEmpty()) { return true; } for (ReferenceType rt : referenceTypes) { // Check whether breakpoint requests' types contains rt: boolean contains = false; for (BreakpointRequest br : brs) { ReferenceType brt = br.location().declaringType(); if (rt.equals(brt)) { contains = true; break; } } if (!contains) { return false; } } return true; }
Example #23
Source File: VMTargetStarter.java From gravel with Apache License 2.0 | 5 votes |
private void installHaltPoint(VirtualMachine vm) { List<ReferenceType> targetClasses = vm .classesByName(VMLocalTarget.class.getName()); ReferenceType classRef = targetClasses.get(0); Method meth = classRef.methodsByName("haltPoint").get(0); BreakpointRequest req = vm.eventRequestManager() .createBreakpointRequest(meth.location()); req.setSuspendPolicy(BreakpointRequest.SUSPEND_EVENT_THREAD); req.enable(); }
Example #24
Source File: VirtualMachineImpl.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
public void redefineClasses(Map<? extends ReferenceType,byte[]> classToBytes) { int cnt = classToBytes.size(); JDWP.VirtualMachine.RedefineClasses.ClassDef[] defs = new JDWP.VirtualMachine.RedefineClasses.ClassDef[cnt]; validateVM(); if (!canRedefineClasses()) { throw new UnsupportedOperationException(); } Iterator<?> it = classToBytes.entrySet().iterator(); for (int i = 0; it.hasNext(); i++) { Map.Entry<?,?> entry = (Map.Entry)it.next(); ReferenceTypeImpl refType = (ReferenceTypeImpl)entry.getKey(); validateMirror(refType); defs[i] = new JDWP.VirtualMachine.RedefineClasses .ClassDef(refType, (byte[])entry.getValue()); } // flush caches and disable caching until the next suspend vm.state().thaw(); try { JDWP.VirtualMachine.RedefineClasses. process(vm, defs); } catch (JDWPException exc) { switch (exc.errorCode()) { case JDWP.Error.INVALID_CLASS_FORMAT : throw new ClassFormatError( "class not in class file format"); case JDWP.Error.CIRCULAR_CLASS_DEFINITION : throw new ClassCircularityError( "circularity has been detected while initializing a class"); case JDWP.Error.FAILS_VERIFICATION : throw new VerifyError( "verifier detected internal inconsistency or security problem"); case JDWP.Error.UNSUPPORTED_VERSION : throw new UnsupportedClassVersionError( "version numbers of class are not supported"); case JDWP.Error.ADD_METHOD_NOT_IMPLEMENTED: throw new UnsupportedOperationException( "add method not implemented"); case JDWP.Error.SCHEMA_CHANGE_NOT_IMPLEMENTED : throw new UnsupportedOperationException( "schema change not implemented"); case JDWP.Error.HIERARCHY_CHANGE_NOT_IMPLEMENTED: throw new UnsupportedOperationException( "hierarchy change not implemented"); case JDWP.Error.DELETE_METHOD_NOT_IMPLEMENTED : throw new UnsupportedOperationException( "delete method not implemented"); case JDWP.Error.CLASS_MODIFIERS_CHANGE_NOT_IMPLEMENTED: throw new UnsupportedOperationException( "changes to class modifiers not implemented"); case JDWP.Error.METHOD_MODIFIERS_CHANGE_NOT_IMPLEMENTED : throw new UnsupportedOperationException( "changes to method modifiers not implemented"); case JDWP.Error.NAMES_DONT_MATCH : throw new NoClassDefFoundError( "class names do not match"); default: throw exc.toJDIException(); } } // Delete any record of the breakpoints List<BreakpointRequest> toDelete = new ArrayList<BreakpointRequest>(); EventRequestManager erm = eventRequestManager(); it = erm.breakpointRequests().iterator(); while (it.hasNext()) { BreakpointRequest req = (BreakpointRequest)it.next(); if (classToBytes.containsKey(req.location().declaringType())) { toDelete.add(req); } } erm.deleteEventRequests(toDelete); // Invalidate any information cached for the classes just redefined. it = classToBytes.keySet().iterator(); while (it.hasNext()) { ReferenceTypeImpl rti = (ReferenceTypeImpl)it.next(); rti.noticeRedefineClass(); } }
Example #25
Source File: VirtualMachineImpl.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
public void redefineClasses(Map<? extends ReferenceType,byte[]> classToBytes) { int cnt = classToBytes.size(); JDWP.VirtualMachine.RedefineClasses.ClassDef[] defs = new JDWP.VirtualMachine.RedefineClasses.ClassDef[cnt]; validateVM(); if (!canRedefineClasses()) { throw new UnsupportedOperationException(); } Iterator<?> it = classToBytes.entrySet().iterator(); for (int i = 0; it.hasNext(); i++) { Map.Entry<?,?> entry = (Map.Entry)it.next(); ReferenceTypeImpl refType = (ReferenceTypeImpl)entry.getKey(); validateMirror(refType); defs[i] = new JDWP.VirtualMachine.RedefineClasses .ClassDef(refType, (byte[])entry.getValue()); } // flush caches and disable caching until the next suspend vm.state().thaw(); try { JDWP.VirtualMachine.RedefineClasses. process(vm, defs); } catch (JDWPException exc) { switch (exc.errorCode()) { case JDWP.Error.INVALID_CLASS_FORMAT : throw new ClassFormatError( "class not in class file format"); case JDWP.Error.CIRCULAR_CLASS_DEFINITION : throw new ClassCircularityError( "circularity has been detected while initializing a class"); case JDWP.Error.FAILS_VERIFICATION : throw new VerifyError( "verifier detected internal inconsistency or security problem"); case JDWP.Error.UNSUPPORTED_VERSION : throw new UnsupportedClassVersionError( "version numbers of class are not supported"); case JDWP.Error.ADD_METHOD_NOT_IMPLEMENTED: throw new UnsupportedOperationException( "add method not implemented"); case JDWP.Error.SCHEMA_CHANGE_NOT_IMPLEMENTED : throw new UnsupportedOperationException( "schema change not implemented"); case JDWP.Error.HIERARCHY_CHANGE_NOT_IMPLEMENTED: throw new UnsupportedOperationException( "hierarchy change not implemented"); case JDWP.Error.DELETE_METHOD_NOT_IMPLEMENTED : throw new UnsupportedOperationException( "delete method not implemented"); case JDWP.Error.CLASS_MODIFIERS_CHANGE_NOT_IMPLEMENTED: throw new UnsupportedOperationException( "changes to class modifiers not implemented"); case JDWP.Error.METHOD_MODIFIERS_CHANGE_NOT_IMPLEMENTED : throw new UnsupportedOperationException( "changes to method modifiers not implemented"); case JDWP.Error.NAMES_DONT_MATCH : throw new NoClassDefFoundError( "class names do not match"); default: throw exc.toJDIException(); } } // Delete any record of the breakpoints List<BreakpointRequest> toDelete = new ArrayList<BreakpointRequest>(); EventRequestManager erm = eventRequestManager(); it = erm.breakpointRequests().iterator(); while (it.hasNext()) { BreakpointRequest req = (BreakpointRequest)it.next(); if (classToBytes.containsKey(req.location().declaringType())) { toDelete.add(req); } } erm.deleteEventRequests(toDelete); // Invalidate any information cached for the classes just redefined. it = classToBytes.keySet().iterator(); while (it.hasNext()) { ReferenceTypeImpl rti = (ReferenceTypeImpl)it.next(); rti.noticeRedefineClass(); } }
Example #26
Source File: VirtualMachineImpl.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
public void redefineClasses(Map<? extends ReferenceType,byte[]> classToBytes) { int cnt = classToBytes.size(); JDWP.VirtualMachine.RedefineClasses.ClassDef[] defs = new JDWP.VirtualMachine.RedefineClasses.ClassDef[cnt]; validateVM(); if (!canRedefineClasses()) { throw new UnsupportedOperationException(); } Iterator<?> it = classToBytes.entrySet().iterator(); for (int i = 0; it.hasNext(); i++) { Map.Entry<?,?> entry = (Map.Entry)it.next(); ReferenceTypeImpl refType = (ReferenceTypeImpl)entry.getKey(); validateMirror(refType); defs[i] = new JDWP.VirtualMachine.RedefineClasses .ClassDef(refType, (byte[])entry.getValue()); } // flush caches and disable caching until the next suspend vm.state().thaw(); try { JDWP.VirtualMachine.RedefineClasses. process(vm, defs); } catch (JDWPException exc) { switch (exc.errorCode()) { case JDWP.Error.INVALID_CLASS_FORMAT : throw new ClassFormatError( "class not in class file format"); case JDWP.Error.CIRCULAR_CLASS_DEFINITION : throw new ClassCircularityError( "circularity has been detected while initializing a class"); case JDWP.Error.FAILS_VERIFICATION : throw new VerifyError( "verifier detected internal inconsistency or security problem"); case JDWP.Error.UNSUPPORTED_VERSION : throw new UnsupportedClassVersionError( "version numbers of class are not supported"); case JDWP.Error.ADD_METHOD_NOT_IMPLEMENTED: throw new UnsupportedOperationException( "add method not implemented"); case JDWP.Error.SCHEMA_CHANGE_NOT_IMPLEMENTED : throw new UnsupportedOperationException( "schema change not implemented"); case JDWP.Error.HIERARCHY_CHANGE_NOT_IMPLEMENTED: throw new UnsupportedOperationException( "hierarchy change not implemented"); case JDWP.Error.DELETE_METHOD_NOT_IMPLEMENTED : throw new UnsupportedOperationException( "delete method not implemented"); case JDWP.Error.CLASS_MODIFIERS_CHANGE_NOT_IMPLEMENTED: throw new UnsupportedOperationException( "changes to class modifiers not implemented"); case JDWP.Error.METHOD_MODIFIERS_CHANGE_NOT_IMPLEMENTED : throw new UnsupportedOperationException( "changes to method modifiers not implemented"); case JDWP.Error.NAMES_DONT_MATCH : throw new NoClassDefFoundError( "class names do not match"); default: throw exc.toJDIException(); } } // Delete any record of the breakpoints List<BreakpointRequest> toDelete = new ArrayList<BreakpointRequest>(); EventRequestManager erm = eventRequestManager(); it = erm.breakpointRequests().iterator(); while (it.hasNext()) { BreakpointRequest req = (BreakpointRequest)it.next(); if (classToBytes.containsKey(req.location().declaringType())) { toDelete.add(req); } } erm.deleteEventRequests(toDelete); // Invalidate any information cached for the classes just redefined. it = classToBytes.keySet().iterator(); while (it.hasNext()) { ReferenceTypeImpl rti = (ReferenceTypeImpl)it.next(); rti.noticeRedefineClass(); } }
Example #27
Source File: VirtualMachineImpl.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
public void redefineClasses(Map<? extends ReferenceType,byte[]> classToBytes) { int cnt = classToBytes.size(); JDWP.VirtualMachine.RedefineClasses.ClassDef[] defs = new JDWP.VirtualMachine.RedefineClasses.ClassDef[cnt]; validateVM(); if (!canRedefineClasses()) { throw new UnsupportedOperationException(); } Iterator<?> it = classToBytes.entrySet().iterator(); for (int i = 0; it.hasNext(); i++) { Map.Entry<?,?> entry = (Map.Entry)it.next(); ReferenceTypeImpl refType = (ReferenceTypeImpl)entry.getKey(); validateMirror(refType); defs[i] = new JDWP.VirtualMachine.RedefineClasses .ClassDef(refType, (byte[])entry.getValue()); } // flush caches and disable caching until the next suspend vm.state().thaw(); try { JDWP.VirtualMachine.RedefineClasses. process(vm, defs); } catch (JDWPException exc) { switch (exc.errorCode()) { case JDWP.Error.INVALID_CLASS_FORMAT : throw new ClassFormatError( "class not in class file format"); case JDWP.Error.CIRCULAR_CLASS_DEFINITION : throw new ClassCircularityError( "circularity has been detected while initializing a class"); case JDWP.Error.FAILS_VERIFICATION : throw new VerifyError( "verifier detected internal inconsistency or security problem"); case JDWP.Error.UNSUPPORTED_VERSION : throw new UnsupportedClassVersionError( "version numbers of class are not supported"); case JDWP.Error.ADD_METHOD_NOT_IMPLEMENTED: throw new UnsupportedOperationException( "add method not implemented"); case JDWP.Error.SCHEMA_CHANGE_NOT_IMPLEMENTED : throw new UnsupportedOperationException( "schema change not implemented"); case JDWP.Error.HIERARCHY_CHANGE_NOT_IMPLEMENTED: throw new UnsupportedOperationException( "hierarchy change not implemented"); case JDWP.Error.DELETE_METHOD_NOT_IMPLEMENTED : throw new UnsupportedOperationException( "delete method not implemented"); case JDWP.Error.CLASS_MODIFIERS_CHANGE_NOT_IMPLEMENTED: throw new UnsupportedOperationException( "changes to class modifiers not implemented"); case JDWP.Error.METHOD_MODIFIERS_CHANGE_NOT_IMPLEMENTED : throw new UnsupportedOperationException( "changes to method modifiers not implemented"); case JDWP.Error.NAMES_DONT_MATCH : throw new NoClassDefFoundError( "class names do not match"); default: throw exc.toJDIException(); } } // Delete any record of the breakpoints List<BreakpointRequest> toDelete = new ArrayList<BreakpointRequest>(); EventRequestManager erm = eventRequestManager(); it = erm.breakpointRequests().iterator(); while (it.hasNext()) { BreakpointRequest req = (BreakpointRequest)it.next(); if (classToBytes.containsKey(req.location().declaringType())) { toDelete.add(req); } } erm.deleteEventRequests(toDelete); // Invalidate any information cached for the classes just redefined. it = classToBytes.keySet().iterator(); while (it.hasNext()) { ReferenceTypeImpl rti = (ReferenceTypeImpl)it.next(); rti.noticeRedefineClass(); } }
Example #28
Source File: VirtualMachineImpl.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
public void redefineClasses(Map<? extends ReferenceType,byte[]> classToBytes) { int cnt = classToBytes.size(); JDWP.VirtualMachine.RedefineClasses.ClassDef[] defs = new JDWP.VirtualMachine.RedefineClasses.ClassDef[cnt]; validateVM(); if (!canRedefineClasses()) { throw new UnsupportedOperationException(); } Iterator<?> it = classToBytes.entrySet().iterator(); for (int i = 0; it.hasNext(); i++) { Map.Entry<?,?> entry = (Map.Entry)it.next(); ReferenceTypeImpl refType = (ReferenceTypeImpl)entry.getKey(); validateMirror(refType); defs[i] = new JDWP.VirtualMachine.RedefineClasses .ClassDef(refType, (byte[])entry.getValue()); } // flush caches and disable caching until the next suspend vm.state().thaw(); try { JDWP.VirtualMachine.RedefineClasses. process(vm, defs); } catch (JDWPException exc) { switch (exc.errorCode()) { case JDWP.Error.INVALID_CLASS_FORMAT : throw new ClassFormatError( "class not in class file format"); case JDWP.Error.CIRCULAR_CLASS_DEFINITION : throw new ClassCircularityError( "circularity has been detected while initializing a class"); case JDWP.Error.FAILS_VERIFICATION : throw new VerifyError( "verifier detected internal inconsistency or security problem"); case JDWP.Error.UNSUPPORTED_VERSION : throw new UnsupportedClassVersionError( "version numbers of class are not supported"); case JDWP.Error.ADD_METHOD_NOT_IMPLEMENTED: throw new UnsupportedOperationException( "add method not implemented"); case JDWP.Error.SCHEMA_CHANGE_NOT_IMPLEMENTED : throw new UnsupportedOperationException( "schema change not implemented"); case JDWP.Error.HIERARCHY_CHANGE_NOT_IMPLEMENTED: throw new UnsupportedOperationException( "hierarchy change not implemented"); case JDWP.Error.DELETE_METHOD_NOT_IMPLEMENTED : throw new UnsupportedOperationException( "delete method not implemented"); case JDWP.Error.CLASS_MODIFIERS_CHANGE_NOT_IMPLEMENTED: throw new UnsupportedOperationException( "changes to class modifiers not implemented"); case JDWP.Error.METHOD_MODIFIERS_CHANGE_NOT_IMPLEMENTED : throw new UnsupportedOperationException( "changes to method modifiers not implemented"); case JDWP.Error.NAMES_DONT_MATCH : throw new NoClassDefFoundError( "class names do not match"); default: throw exc.toJDIException(); } } // Delete any record of the breakpoints List<BreakpointRequest> toDelete = new ArrayList<BreakpointRequest>(); EventRequestManager erm = eventRequestManager(); it = erm.breakpointRequests().iterator(); while (it.hasNext()) { BreakpointRequest req = (BreakpointRequest)it.next(); if (classToBytes.containsKey(req.location().declaringType())) { toDelete.add(req); } } erm.deleteEventRequests(toDelete); // Invalidate any information cached for the classes just redefined. it = classToBytes.keySet().iterator(); while (it.hasNext()) { ReferenceTypeImpl rti = (ReferenceTypeImpl)it.next(); rti.noticeRedefineClass(); } }
Example #29
Source File: VirtualMachineImpl.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
public void redefineClasses(Map<? extends ReferenceType,byte[]> classToBytes) { int cnt = classToBytes.size(); JDWP.VirtualMachine.RedefineClasses.ClassDef[] defs = new JDWP.VirtualMachine.RedefineClasses.ClassDef[cnt]; validateVM(); if (!canRedefineClasses()) { throw new UnsupportedOperationException(); } Iterator<?> it = classToBytes.entrySet().iterator(); for (int i = 0; it.hasNext(); i++) { Map.Entry<?,?> entry = (Map.Entry)it.next(); ReferenceTypeImpl refType = (ReferenceTypeImpl)entry.getKey(); validateMirror(refType); defs[i] = new JDWP.VirtualMachine.RedefineClasses .ClassDef(refType, (byte[])entry.getValue()); } // flush caches and disable caching until the next suspend vm.state().thaw(); try { JDWP.VirtualMachine.RedefineClasses. process(vm, defs); } catch (JDWPException exc) { switch (exc.errorCode()) { case JDWP.Error.INVALID_CLASS_FORMAT : throw new ClassFormatError( "class not in class file format"); case JDWP.Error.CIRCULAR_CLASS_DEFINITION : throw new ClassCircularityError( "circularity has been detected while initializing a class"); case JDWP.Error.FAILS_VERIFICATION : throw new VerifyError( "verifier detected internal inconsistency or security problem"); case JDWP.Error.UNSUPPORTED_VERSION : throw new UnsupportedClassVersionError( "version numbers of class are not supported"); case JDWP.Error.ADD_METHOD_NOT_IMPLEMENTED: throw new UnsupportedOperationException( "add method not implemented"); case JDWP.Error.SCHEMA_CHANGE_NOT_IMPLEMENTED : throw new UnsupportedOperationException( "schema change not implemented"); case JDWP.Error.HIERARCHY_CHANGE_NOT_IMPLEMENTED: throw new UnsupportedOperationException( "hierarchy change not implemented"); case JDWP.Error.DELETE_METHOD_NOT_IMPLEMENTED : throw new UnsupportedOperationException( "delete method not implemented"); case JDWP.Error.CLASS_MODIFIERS_CHANGE_NOT_IMPLEMENTED: throw new UnsupportedOperationException( "changes to class modifiers not implemented"); case JDWP.Error.METHOD_MODIFIERS_CHANGE_NOT_IMPLEMENTED : throw new UnsupportedOperationException( "changes to method modifiers not implemented"); case JDWP.Error.NAMES_DONT_MATCH : throw new NoClassDefFoundError( "class names do not match"); default: throw exc.toJDIException(); } } // Delete any record of the breakpoints List<BreakpointRequest> toDelete = new ArrayList<BreakpointRequest>(); EventRequestManager erm = eventRequestManager(); it = erm.breakpointRequests().iterator(); while (it.hasNext()) { BreakpointRequest req = (BreakpointRequest)it.next(); if (classToBytes.containsKey(req.location().declaringType())) { toDelete.add(req); } } erm.deleteEventRequests(toDelete); // Invalidate any information cached for the classes just redefined. it = classToBytes.keySet().iterator(); while (it.hasNext()) { ReferenceTypeImpl rti = (ReferenceTypeImpl)it.next(); rti.noticeRedefineClass(); } }
Example #30
Source File: VirtualMachineImpl.java From hottub with GNU General Public License v2.0 | 4 votes |
public void redefineClasses(Map<? extends ReferenceType,byte[]> classToBytes) { int cnt = classToBytes.size(); JDWP.VirtualMachine.RedefineClasses.ClassDef[] defs = new JDWP.VirtualMachine.RedefineClasses.ClassDef[cnt]; validateVM(); if (!canRedefineClasses()) { throw new UnsupportedOperationException(); } Iterator<?> it = classToBytes.entrySet().iterator(); for (int i = 0; it.hasNext(); i++) { Map.Entry<?,?> entry = (Map.Entry)it.next(); ReferenceTypeImpl refType = (ReferenceTypeImpl)entry.getKey(); validateMirror(refType); defs[i] = new JDWP.VirtualMachine.RedefineClasses .ClassDef(refType, (byte[])entry.getValue()); } // flush caches and disable caching until the next suspend vm.state().thaw(); try { JDWP.VirtualMachine.RedefineClasses. process(vm, defs); } catch (JDWPException exc) { switch (exc.errorCode()) { case JDWP.Error.INVALID_CLASS_FORMAT : throw new ClassFormatError( "class not in class file format"); case JDWP.Error.CIRCULAR_CLASS_DEFINITION : throw new ClassCircularityError( "circularity has been detected while initializing a class"); case JDWP.Error.FAILS_VERIFICATION : throw new VerifyError( "verifier detected internal inconsistency or security problem"); case JDWP.Error.UNSUPPORTED_VERSION : throw new UnsupportedClassVersionError( "version numbers of class are not supported"); case JDWP.Error.ADD_METHOD_NOT_IMPLEMENTED: throw new UnsupportedOperationException( "add method not implemented"); case JDWP.Error.SCHEMA_CHANGE_NOT_IMPLEMENTED : throw new UnsupportedOperationException( "schema change not implemented"); case JDWP.Error.HIERARCHY_CHANGE_NOT_IMPLEMENTED: throw new UnsupportedOperationException( "hierarchy change not implemented"); case JDWP.Error.DELETE_METHOD_NOT_IMPLEMENTED : throw new UnsupportedOperationException( "delete method not implemented"); case JDWP.Error.CLASS_MODIFIERS_CHANGE_NOT_IMPLEMENTED: throw new UnsupportedOperationException( "changes to class modifiers not implemented"); case JDWP.Error.METHOD_MODIFIERS_CHANGE_NOT_IMPLEMENTED : throw new UnsupportedOperationException( "changes to method modifiers not implemented"); case JDWP.Error.NAMES_DONT_MATCH : throw new NoClassDefFoundError( "class names do not match"); default: throw exc.toJDIException(); } } // Delete any record of the breakpoints List<BreakpointRequest> toDelete = new ArrayList<BreakpointRequest>(); EventRequestManager erm = eventRequestManager(); it = erm.breakpointRequests().iterator(); while (it.hasNext()) { BreakpointRequest req = (BreakpointRequest)it.next(); if (classToBytes.containsKey(req.location().declaringType())) { toDelete.add(req); } } erm.deleteEventRequests(toDelete); // Invalidate any information cached for the classes just redefined. it = classToBytes.keySet().iterator(); while (it.hasNext()) { ReferenceTypeImpl rti = (ReferenceTypeImpl)it.next(); rti.noticeRedefineClass(); } }