com.sun.jdi.event.ClassPrepareEvent Java Examples
The following examples show how to use
com.sun.jdi.event.ClassPrepareEvent.
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: EventRequestSpecList.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
/** * Resolve all deferred eventRequests waiting for 'refType'. * @return true if it completes successfully, false on error. */ boolean resolve(ClassPrepareEvent event) { boolean failure = false; synchronized(eventRequestSpecs) { for (EventRequestSpec spec : eventRequestSpecs) { if (!spec.isResolved()) { try { EventRequest eventRequest = spec.resolve(event); if (eventRequest != null) { MessageOutput.println("Set deferred", spec.toString()); } } catch (Exception e) { MessageOutput.println("Unable to set deferred", new Object [] {spec.toString(), spec.errorMessageFor(e)}); failure = true; } } } } return !failure; }
Example #2
Source File: EventRequestSpecList.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
/** * Resolve all deferred eventRequests waiting for 'refType'. * @return true if it completes successfully, false on error. */ boolean resolve(ClassPrepareEvent event) { boolean failure = false; synchronized(eventRequestSpecs) { for (EventRequestSpec spec : eventRequestSpecs) { if (!spec.isResolved()) { try { EventRequest eventRequest = spec.resolve(event); if (eventRequest != null) { MessageOutput.println("Set deferred", spec.toString()); } } catch (Exception e) { MessageOutput.println("Unable to set deferred", new Object [] {spec.toString(), spec.errorMessageFor(e)}); failure = true; } } } } return !failure; }
Example #3
Source File: EventRequestSpecList.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * Resolve all deferred eventRequests waiting for 'refType'. * @return true if it completes successfully, false on error. */ boolean resolve(ClassPrepareEvent event) { boolean failure = false; synchronized(eventRequestSpecs) { for (EventRequestSpec spec : eventRequestSpecs) { if (!spec.isResolved()) { try { EventRequest eventRequest = spec.resolve(event); if (eventRequest != null) { MessageOutput.println("Set deferred", spec.toString()); } } catch (Exception e) { MessageOutput.println("Unable to set deferred", new Object [] {spec.toString(), spec.errorMessageFor(e)}); failure = true; } } } } return !failure; }
Example #4
Source File: EventRequestSpecList.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
/** * Resolve all deferred eventRequests waiting for 'refType'. * @return true if it completes successfully, false on error. */ boolean resolve(ClassPrepareEvent event) { boolean failure = false; synchronized(eventRequestSpecs) { for (EventRequestSpec spec : eventRequestSpecs) { if (!spec.isResolved()) { try { EventRequest eventRequest = spec.resolve(event); if (eventRequest != null) { MessageOutput.println("Set deferred", spec.toString()); } } catch (Exception e) { MessageOutput.println("Unable to set deferred", new Object [] {spec.toString(), spec.errorMessageFor(e)}); failure = true; } } } } return !failure; }
Example #5
Source File: EventRequestSpecList.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * Resolve all deferred eventRequests waiting for 'refType'. * @return true if it completes successfully, false on error. */ boolean resolve(ClassPrepareEvent event) { boolean failure = false; synchronized(eventRequestSpecs) { for (EventRequestSpec spec : eventRequestSpecs) { if (!spec.isResolved()) { try { EventRequest eventRequest = spec.resolve(event); if (eventRequest != null) { MessageOutput.println("Set deferred", spec.toString()); } } catch (Exception e) { MessageOutput.println("Unable to set deferred", new Object [] {spec.toString(), spec.errorMessageFor(e)}); failure = true; } } } } return !failure; }
Example #6
Source File: EventRequestSpecList.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
/** * Resolve all deferred eventRequests waiting for 'refType'. * @return true if it completes successfully, false on error. */ boolean resolve(ClassPrepareEvent event) { boolean failure = false; synchronized(eventRequestSpecs) { for (EventRequestSpec spec : eventRequestSpecs) { if (!spec.isResolved()) { try { EventRequest eventRequest = spec.resolve(event); if (eventRequest != null) { MessageOutput.println("Set deferred", spec.toString()); } } catch (Exception e) { MessageOutput.println("Unable to set deferred", new Object [] {spec.toString(), spec.errorMessageFor(e)}); failure = true; } } } } return !failure; }
Example #7
Source File: EventRequestSpecList.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * Resolve all deferred eventRequests waiting for 'refType'. * @return true if it completes successfully, false on error. */ boolean resolve(ClassPrepareEvent event) { boolean failure = false; synchronized(eventRequestSpecs) { for (EventRequestSpec spec : eventRequestSpecs) { if (!spec.isResolved()) { try { EventRequest eventRequest = spec.resolve(event); if (eventRequest != null) { MessageOutput.println("Set deferred", spec.toString()); } } catch (Exception e) { MessageOutput.println("Unable to set deferred", new Object [] {spec.toString(), spec.errorMessageFor(e)}); failure = true; } } } } return !failure; }
Example #8
Source File: EventRequestSpecList.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * Resolve all deferred eventRequests waiting for 'refType'. * @return true if it completes successfully, false on error. */ boolean resolve(ClassPrepareEvent event) { boolean failure = false; synchronized(eventRequestSpecs) { for (EventRequestSpec spec : eventRequestSpecs) { if (!spec.isResolved()) { try { EventRequest eventRequest = spec.resolve(event); if (eventRequest != null) { MessageOutput.println("Set deferred", spec.toString()); } } catch (Exception e) { MessageOutput.println("Unable to set deferred", new Object [] {spec.toString(), spec.errorMessageFor(e)}); failure = true; } } } } return !failure; }
Example #9
Source File: EventRequestSpecList.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Resolve all deferred eventRequests waiting for 'refType'. * @return true if it completes successfully, false on error. */ boolean resolve(ClassPrepareEvent event) { boolean failure = false; synchronized(eventRequestSpecs) { for (EventRequestSpec spec : eventRequestSpecs) { if (!spec.isResolved()) { try { EventRequest eventRequest = spec.resolve(event); if (eventRequest != null) { MessageOutput.println("Set deferred", spec.toString()); } } catch (Exception e) { MessageOutput.println("Unable to set deferred", new Object [] {spec.toString(), spec.errorMessageFor(e)}); failure = true; } } } } return !failure; }
Example #10
Source File: EventRequestSpecList.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * Resolve all deferred eventRequests waiting for 'refType'. * @return true if it completes successfully, false on error. */ boolean resolve(ClassPrepareEvent event) { boolean failure = false; synchronized(eventRequestSpecs) { for (EventRequestSpec spec : eventRequestSpecs) { if (!spec.isResolved()) { try { EventRequest eventRequest = spec.resolve(event); if (eventRequest != null) { MessageOutput.println("Set deferred", spec.toString()); } } catch (Exception e) { MessageOutput.println("Unable to set deferred", new Object [] {spec.toString(), spec.errorMessageFor(e)}); failure = true; } } } } return !failure; }
Example #11
Source File: EventRequestSpecList.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * Resolve all deferred eventRequests waiting for 'refType'. * @return true if it completes successfully, false on error. */ boolean resolve(ClassPrepareEvent event) { boolean failure = false; synchronized(eventRequestSpecs) { for (EventRequestSpec spec : eventRequestSpecs) { if (!spec.isResolved()) { try { EventRequest eventRequest = spec.resolve(event); if (eventRequest != null) { MessageOutput.println("Set deferred", spec.toString()); } } catch (Exception e) { MessageOutput.println("Unable to set deferred", new Object [] {spec.toString(), spec.errorMessageFor(e)}); failure = true; } } } } return !failure; }
Example #12
Source File: EventRequestSpecList.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * Resolve all deferred eventRequests waiting for 'refType'. * @return true if it completes successfully, false on error. */ boolean resolve(ClassPrepareEvent event) { boolean failure = false; synchronized(eventRequestSpecs) { for (EventRequestSpec spec : eventRequestSpecs) { if (!spec.isResolved()) { try { EventRequest eventRequest = spec.resolve(event); if (eventRequest != null) { MessageOutput.println("Set deferred", spec.toString()); } } catch (Exception e) { MessageOutput.println("Unable to set deferred", new Object [] {spec.toString(), spec.errorMessageFor(e)}); failure = true; } } } } return !failure; }
Example #13
Source File: EventRequestSpecList.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * Resolve all deferred eventRequests waiting for 'refType'. * @return true if it completes successfully, false on error. */ boolean resolve(ClassPrepareEvent event) { boolean failure = false; synchronized(eventRequestSpecs) { for (EventRequestSpec spec : eventRequestSpecs) { if (!spec.isResolved()) { try { EventRequest eventRequest = spec.resolve(event); if (eventRequest != null) { MessageOutput.println("Set deferred", spec.toString()); } } catch (Exception e) { MessageOutput.println("Unable to set deferred", new Object [] {spec.toString(), spec.errorMessageFor(e)}); failure = true; } } } } return !failure; }
Example #14
Source File: EventRequestSpec.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * @return If this EventRequestSpec matches the 'refType' * return the cooresponding EventRequest. Otherwise * return null. */ synchronized EventRequest resolve(ClassPrepareEvent event) throws Exception { if ((resolved == null) && (prepareRequest != null) && prepareRequest.equals(event.request())) { resolved = resolveEventRequest(event.referenceType()); prepareRequest.disable(); Env.vm().eventRequestManager().deleteEventRequest(prepareRequest); prepareRequest = null; if (refSpec instanceof PatternReferenceTypeSpec) { PatternReferenceTypeSpec prs = (PatternReferenceTypeSpec)refSpec; if (! prs.isUnique()){ /* * Class pattern event requests are never * considered "resolved", since future class loads * might also match. * Create and enable a new ClassPrepareRequest to * keep trying to resolve. */ resolved = null; prepareRequest = refSpec.createPrepareRequest(); prepareRequest.enable(); } } } return resolved; }
Example #15
Source File: EventRequestSpec.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
/** * @return If this EventRequestSpec matches the 'refType' * return the cooresponding EventRequest. Otherwise * return null. */ synchronized EventRequest resolve(ClassPrepareEvent event) throws Exception { if ((resolved == null) && (prepareRequest != null) && prepareRequest.equals(event.request())) { resolved = resolveEventRequest(event.referenceType()); prepareRequest.disable(); Env.vm().eventRequestManager().deleteEventRequest(prepareRequest); prepareRequest = null; if (refSpec instanceof PatternReferenceTypeSpec) { PatternReferenceTypeSpec prs = (PatternReferenceTypeSpec)refSpec; if (! prs.isUnique()){ /* * Class pattern event requests are never * considered "resolved", since future class loads * might also match. * Create and enable a new ClassPrepareRequest to * keep trying to resolve. */ resolved = null; prepareRequest = refSpec.createPrepareRequest(); prepareRequest.enable(); } } } return resolved; }
Example #16
Source File: EventRequestSpec.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
/** * @return If this EventRequestSpec matches the 'refType' * return the cooresponding EventRequest. Otherwise * return null. */ synchronized EventRequest resolve(ClassPrepareEvent event) throws Exception { if ((resolved == null) && (prepareRequest != null) && prepareRequest.equals(event.request())) { resolved = resolveEventRequest(event.referenceType()); prepareRequest.disable(); Env.vm().eventRequestManager().deleteEventRequest(prepareRequest); prepareRequest = null; if (refSpec instanceof PatternReferenceTypeSpec) { PatternReferenceTypeSpec prs = (PatternReferenceTypeSpec)refSpec; if (! prs.isUnique()){ /* * Class pattern event requests are never * considered "resolved", since future class loads * might also match. * Create and enable a new ClassPrepareRequest to * keep trying to resolve. */ resolved = null; prepareRequest = refSpec.createPrepareRequest(); prepareRequest.enable(); } } } return resolved; }
Example #17
Source File: EventRequestSpec.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * @return If this EventRequestSpec matches the 'refType' * return the cooresponding EventRequest. Otherwise * return null. */ synchronized EventRequest resolve(ClassPrepareEvent event) throws Exception { if ((resolved == null) && (prepareRequest != null) && prepareRequest.equals(event.request())) { resolved = resolveEventRequest(event.referenceType()); prepareRequest.disable(); Env.vm().eventRequestManager().deleteEventRequest(prepareRequest); prepareRequest = null; if (refSpec instanceof PatternReferenceTypeSpec) { PatternReferenceTypeSpec prs = (PatternReferenceTypeSpec)refSpec; if (! prs.isUnique()){ /* * Class pattern event requests are never * considered "resolved", since future class loads * might also match. * Create and enable a new ClassPrepareRequest to * keep trying to resolve. */ resolved = null; prepareRequest = refSpec.createPrepareRequest(); prepareRequest.enable(); } } } return resolved; }
Example #18
Source File: EventRequestSpec.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * @return If this EventRequestSpec matches the 'refType' * return the cooresponding EventRequest. Otherwise * return null. */ synchronized EventRequest resolve(ClassPrepareEvent event) throws Exception { if ((resolved == null) && (prepareRequest != null) && prepareRequest.equals(event.request())) { resolved = resolveEventRequest(event.referenceType()); prepareRequest.disable(); Env.vm().eventRequestManager().deleteEventRequest(prepareRequest); prepareRequest = null; if (refSpec instanceof PatternReferenceTypeSpec) { PatternReferenceTypeSpec prs = (PatternReferenceTypeSpec)refSpec; if (! prs.isUnique()){ /* * Class pattern event requests are never * considered "resolved", since future class loads * might also match. * Create and enable a new ClassPrepareRequest to * keep trying to resolve. */ resolved = null; prepareRequest = refSpec.createPrepareRequest(); prepareRequest.enable(); } } } return resolved; }
Example #19
Source File: EventRequestSpec.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
/** * @return If this EventRequestSpec matches the 'refType' * return the cooresponding EventRequest. Otherwise * return null. */ synchronized EventRequest resolve(ClassPrepareEvent event) throws Exception { if ((resolved == null) && (prepareRequest != null) && prepareRequest.equals(event.request())) { resolved = resolveEventRequest(event.referenceType()); prepareRequest.disable(); Env.vm().eventRequestManager().deleteEventRequest(prepareRequest); prepareRequest = null; if (refSpec instanceof PatternReferenceTypeSpec) { PatternReferenceTypeSpec prs = (PatternReferenceTypeSpec)refSpec; if (! prs.isUnique()){ /* * Class pattern event requests are never * considered "resolved", since future class loads * might also match. * Create and enable a new ClassPrepareRequest to * keep trying to resolve. */ resolved = null; prepareRequest = refSpec.createPrepareRequest(); prepareRequest.enable(); } } } return resolved; }
Example #20
Source File: EventRequestSpec.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * @return If this EventRequestSpec matches the 'refType' * return the cooresponding EventRequest. Otherwise * return null. */ synchronized EventRequest resolve(ClassPrepareEvent event) throws Exception { if ((resolved == null) && (prepareRequest != null) && prepareRequest.equals(event.request())) { resolved = resolveEventRequest(event.referenceType()); prepareRequest.disable(); Env.vm().eventRequestManager().deleteEventRequest(prepareRequest); prepareRequest = null; if (refSpec instanceof PatternReferenceTypeSpec) { PatternReferenceTypeSpec prs = (PatternReferenceTypeSpec)refSpec; if (! prs.isUnique()){ /* * Class pattern event requests are never * considered "resolved", since future class loads * might also match. * Create and enable a new ClassPrepareRequest to * keep trying to resolve. */ resolved = null; prepareRequest = refSpec.createPrepareRequest(); prepareRequest.enable(); } } } return resolved; }
Example #21
Source File: EventRequestSpec.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * @return If this EventRequestSpec matches the 'refType' * return the cooresponding EventRequest. Otherwise * return null. */ synchronized EventRequest resolve(ClassPrepareEvent event) throws Exception { if ((resolved == null) && (prepareRequest != null) && prepareRequest.equals(event.request())) { resolved = resolveEventRequest(event.referenceType()); prepareRequest.disable(); Env.vm().eventRequestManager().deleteEventRequest(prepareRequest); prepareRequest = null; if (refSpec instanceof PatternReferenceTypeSpec) { PatternReferenceTypeSpec prs = (PatternReferenceTypeSpec)refSpec; if (! prs.isUnique()){ /* * Class pattern event requests are never * considered "resolved", since future class loads * might also match. * Create and enable a new ClassPrepareRequest to * keep trying to resolve. */ resolved = null; prepareRequest = refSpec.createPrepareRequest(); prepareRequest.enable(); } } } return resolved; }
Example #22
Source File: EventRequestSpec.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * @return If this EventRequestSpec matches the 'refType' * return the cooresponding EventRequest. Otherwise * return null. */ synchronized EventRequest resolve(ClassPrepareEvent event) throws Exception { if ((resolved == null) && (prepareRequest != null) && prepareRequest.equals(event.request())) { resolved = resolveEventRequest(event.referenceType()); prepareRequest.disable(); Env.vm().eventRequestManager().deleteEventRequest(prepareRequest); prepareRequest = null; if (refSpec instanceof PatternReferenceTypeSpec) { PatternReferenceTypeSpec prs = (PatternReferenceTypeSpec)refSpec; if (! prs.isUnique()){ /* * Class pattern event requests are never * considered "resolved", since future class loads * might also match. * Create and enable a new ClassPrepareRequest to * keep trying to resolve. */ resolved = null; prepareRequest = refSpec.createPrepareRequest(); prepareRequest.enable(); } } } return resolved; }
Example #23
Source File: DynamothCollector.java From astor with GNU General Public License v2.0 | 5 votes |
private void processVMEvents() { try { // process events final EventQueue eventQueue = vm.eventQueue(); while (true) { EventSet eventSet = eventQueue.remove(TimeUnit.SECONDS.toMillis(this.dataCollectionTimeoutInSeconds)); if (eventSet == null) return; // timeout for (Event event : eventSet) { if (event instanceof VMDeathEvent || event instanceof VMDisconnectEvent) { // exit DebugJUnitRunner.process.destroy(); // logger.debug("Exit"); // System.out.println("VM Event: Exit"); return; } else if (event instanceof ClassPrepareEvent) { // logger.debug("ClassPrepareEvent"); // System.out.println("VM event: ClassPrepareEvent"); processClassPrepareEvent(); } else if (event instanceof BreakpointEvent) { // logger.debug("VM Event: BreakpointEvent"); // System.out.println("VM BreakpointEvent"); processBreakPointEvents((BreakpointEvent) event); } } eventSet.resume(); } // end while true } catch (Exception e) { System.err.println("Error processing VMEvents"); e.printStackTrace(); } finally { DebugJUnitRunner.process.destroy(); } }
Example #24
Source File: EventRequestSpec.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * @return If this EventRequestSpec matches the 'refType' * return the cooresponding EventRequest. Otherwise * return null. */ synchronized EventRequest resolve(ClassPrepareEvent event) throws Exception { if ((resolved == null) && (prepareRequest != null) && prepareRequest.equals(event.request())) { resolved = resolveEventRequest(event.referenceType()); prepareRequest.disable(); Env.vm().eventRequestManager().deleteEventRequest(prepareRequest); prepareRequest = null; if (refSpec instanceof PatternReferenceTypeSpec) { PatternReferenceTypeSpec prs = (PatternReferenceTypeSpec)refSpec; if (! prs.isUnique()){ /* * Class pattern event requests are never * considered "resolved", since future class loads * might also match. * Create and enable a new ClassPrepareRequest to * keep trying to resolve. */ resolved = null; prepareRequest = refSpec.createPrepareRequest(); prepareRequest.enable(); } } } return resolved; }
Example #25
Source File: EventRequestSpec.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * @return If this EventRequestSpec matches the 'refType' * return the cooresponding EventRequest. Otherwise * return null. */ synchronized EventRequest resolve(ClassPrepareEvent event) throws Exception { if ((resolved == null) && (prepareRequest != null) && prepareRequest.equals(event.request())) { resolved = resolveEventRequest(event.referenceType()); prepareRequest.disable(); Env.vm().eventRequestManager().deleteEventRequest(prepareRequest); prepareRequest = null; if (refSpec instanceof PatternReferenceTypeSpec) { PatternReferenceTypeSpec prs = (PatternReferenceTypeSpec)refSpec; if (! prs.isUnique()){ /* * Class pattern event requests are never * considered "resolved", since future class loads * might also match. * Create and enable a new ClassPrepareRequest to * keep trying to resolve. */ resolved = null; prepareRequest = refSpec.createPrepareRequest(); prepareRequest.enable(); } } } return resolved; }
Example #26
Source File: EventRequestSpec.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * @return If this EventRequestSpec matches the 'refType' * return the cooresponding EventRequest. Otherwise * return null. */ synchronized EventRequest resolve(ClassPrepareEvent event) throws Exception { if ((resolved == null) && (prepareRequest != null) && prepareRequest.equals(event.request())) { resolved = resolveEventRequest(event.referenceType()); prepareRequest.disable(); Env.vm().eventRequestManager().deleteEventRequest(prepareRequest); prepareRequest = null; if (refSpec instanceof PatternReferenceTypeSpec) { PatternReferenceTypeSpec prs = (PatternReferenceTypeSpec)refSpec; if (! prs.isUnique()){ /* * Class pattern event requests are never * considered "resolved", since future class loads * might also match. * Create and enable a new ClassPrepareRequest to * keep trying to resolve. */ resolved = null; prepareRequest = refSpec.createPrepareRequest(); prepareRequest.enable(); } } } return resolved; }
Example #27
Source File: EventRequestSpec.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * @return If this EventRequestSpec matches the 'refType' * return the cooresponding EventRequest. Otherwise * return null. */ synchronized EventRequest resolve(ClassPrepareEvent event) throws Exception { if ((resolved == null) && (prepareRequest != null) && prepareRequest.equals(event.request())) { resolved = resolveEventRequest(event.referenceType()); prepareRequest.disable(); Env.vm().eventRequestManager().deleteEventRequest(prepareRequest); prepareRequest = null; if (refSpec instanceof PatternReferenceTypeSpec) { PatternReferenceTypeSpec prs = (PatternReferenceTypeSpec)refSpec; if (! prs.isUnique()){ /* * Class pattern event requests are never * considered "resolved", since future class loads * might also match. * Create and enable a new ClassPrepareRequest to * keep trying to resolve. */ resolved = null; prepareRequest = refSpec.createPrepareRequest(); prepareRequest.enable(); } } } return resolved; }
Example #28
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 #29
Source File: FieldMonitor.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
public static void main(String[] args) throws IOException, InterruptedException { //VirtualMachine vm = launchTarget(sb.toString()); VirtualMachine vm = launchTarget(CLASS_NAME); System.out.println("Vm launched"); // process events EventQueue eventQueue = vm.eventQueue(); // resume the vm Process process = vm.process(); // Copy target's output and error to our output and error. Thread outThread = new StreamRedirectThread("out reader", process.getInputStream()); Thread errThread = new StreamRedirectThread("error reader", process.getErrorStream()); errThread.start(); outThread.start(); boolean connected = true; int watched = 0; while (connected) { EventSet eventSet = eventQueue.remove(); for (Event event : eventSet) { System.out.println("FieldMonitor-main receives: "+event); if (event instanceof VMStartEvent) { addClassWatch(vm); } else if (event instanceof VMDeathEvent || event instanceof VMDisconnectEvent) { // exit connected = false; } else if (event instanceof ClassPrepareEvent) { // watch field on loaded class System.out.println("ClassPrepareEvent"); ClassPrepareEvent classPrepEvent = (ClassPrepareEvent) event; ReferenceType refType = classPrepEvent .referenceType(); addFieldWatch(vm, refType); } else if (event instanceof ModificationWatchpointEvent) { watched++; System.out.println("sleep for 500 ms"); Thread.sleep(500); ModificationWatchpointEvent modEvent = (ModificationWatchpointEvent) event; System.out.println("old=" + modEvent.valueCurrent()); System.out.println("new=" + modEvent.valueToBe()); } } System.out.println("resume..."); eventSet.resume(); } // Shutdown begins when event thread terminates try { errThread.join(); // Make sure output is forwarded outThread.join(); } catch (InterruptedException exc) { // we don't interrupt } if (watched != 11) { // init + 10 modifications in TestPostFieldModification class throw new Error("Expected to receive 11 times ModificationWatchpointEvent, but got "+watched); } }
Example #30
Source File: VMTargetStarter.java From gravel with Apache License 2.0 | 4 votes |
public VMRemoteTarget createJVM() throws IOException, InterruptedException, IncompatibleThreadStateException { Process process = startSecondJVM(VMLocalTarget.class); sleep(90); // connect VirtualMachine vm = new VMAcquirer().connect(debugPort); ClassPrepareRequest createClassPrepareRequest = vm .eventRequestManager().createClassPrepareRequest(); createClassPrepareRequest.addClassFilter(VMLocalTarget.class.getName()); createClassPrepareRequest.enable(); vm.resume(); List<ThreadReference> allThreads = vm.allThreads(); for (ThreadReference threadReference : allThreads) { System.out.println(threadReference+" isSuspended: "+threadReference.isSuspended()+" suspendCount: "+threadReference.suspendCount()); } // process events EventQueue eventQueue = vm.eventQueue(); while (true) { EventSet eventSet = eventQueue.remove(); for (Event event : eventSet) { if (event instanceof ClassPrepareEvent) { event.request().disable(); installHaltPoint(vm); } if (event instanceof VMDeathEvent || event instanceof VMDisconnectEvent) { return null; } if (event instanceof BreakpointEvent) { event.request().disable(); ThreadReference thread = ((BreakpointEvent) event).thread(); return new VMRemoteTarget(process, vm, thread, debugPort); } } eventSet.resume(); } }