com.sun.jdi.request.EventRequestManager Java Examples
The following examples show how to use
com.sun.jdi.request.EventRequestManager.
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: VMConnection.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
private void setEventRequests(VirtualMachine vm) { EventRequestManager erm = vm.eventRequestManager(); // Normally, we want all uncaught exceptions. We request them // via the same mechanism as Commands.commandCatchException() // so the user can ignore them later if they are not // interested. // FIXME: this works but generates spurious messages on stdout // during startup: // Set uncaught java.lang.Throwable // Set deferred uncaught java.lang.Throwable Commands evaluator = new Commands(); evaluator.commandCatchException (new StringTokenizer("uncaught java.lang.Throwable")); ThreadStartRequest tsr = erm.createThreadStartRequest(); tsr.enable(); ThreadDeathRequest tdr = erm.createThreadDeathRequest(); tdr.enable(); }
Example #2
Source File: VMConnection.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
private void setEventRequests(VirtualMachine vm) { EventRequestManager erm = vm.eventRequestManager(); // Normally, we want all uncaught exceptions. We request them // via the same mechanism as Commands.commandCatchException() // so the user can ignore them later if they are not // interested. // FIXME: this works but generates spurious messages on stdout // during startup: // Set uncaught java.lang.Throwable // Set deferred uncaught java.lang.Throwable Commands evaluator = new Commands(); evaluator.commandCatchException (new StringTokenizer("uncaught java.lang.Throwable")); ThreadStartRequest tsr = erm.createThreadStartRequest(); tsr.enable(); ThreadDeathRequest tdr = erm.createThreadDeathRequest(); tdr.enable(); }
Example #3
Source File: VMConnection.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
private void setEventRequests(VirtualMachine vm) { EventRequestManager erm = vm.eventRequestManager(); // Normally, we want all uncaught exceptions. We request them // via the same mechanism as Commands.commandCatchException() // so the user can ignore them later if they are not // interested. // FIXME: this works but generates spurious messages on stdout // during startup: // Set uncaught java.lang.Throwable // Set deferred uncaught java.lang.Throwable Commands evaluator = new Commands(); evaluator.commandCatchException (new StringTokenizer("uncaught java.lang.Throwable")); ThreadStartRequest tsr = erm.createThreadStartRequest(); tsr.enable(); ThreadDeathRequest tdr = erm.createThreadDeathRequest(); tdr.enable(); }
Example #4
Source File: VMConnection.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
private void setEventRequests(VirtualMachine vm) { EventRequestManager erm = vm.eventRequestManager(); // Normally, we want all uncaught exceptions. We request them // via the same mechanism as Commands.commandCatchException() // so the user can ignore them later if they are not // interested. // FIXME: this works but generates spurious messages on stdout // during startup: // Set uncaught java.lang.Throwable // Set deferred uncaught java.lang.Throwable Commands evaluator = new Commands(); evaluator.commandCatchException (new StringTokenizer("uncaught java.lang.Throwable")); ThreadStartRequest tsr = erm.createThreadStartRequest(); tsr.enable(); ThreadDeathRequest tdr = erm.createThreadDeathRequest(); tdr.enable(); }
Example #5
Source File: VMConnection.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
private void setEventRequests(VirtualMachine vm) { EventRequestManager erm = vm.eventRequestManager(); // Normally, we want all uncaught exceptions. We request them // via the same mechanism as Commands.commandCatchException() // so the user can ignore them later if they are not // interested. // FIXME: this works but generates spurious messages on stdout // during startup: // Set uncaught java.lang.Throwable // Set deferred uncaught java.lang.Throwable Commands evaluator = new Commands(); evaluator.commandCatchException (new StringTokenizer("uncaught java.lang.Throwable")); ThreadStartRequest tsr = erm.createThreadStartRequest(); tsr.enable(); ThreadDeathRequest tdr = erm.createThreadDeathRequest(); tdr.enable(); }
Example #6
Source File: VMConnection.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
private void setEventRequests(VirtualMachine vm) { EventRequestManager erm = vm.eventRequestManager(); // Normally, we want all uncaught exceptions. We request them // via the same mechanism as Commands.commandCatchException() // so the user can ignore them later if they are not // interested. // FIXME: this works but generates spurious messages on stdout // during startup: // Set uncaught java.lang.Throwable // Set deferred uncaught java.lang.Throwable Commands evaluator = new Commands(); evaluator.commandCatchException (new StringTokenizer("uncaught java.lang.Throwable")); ThreadStartRequest tsr = erm.createThreadStartRequest(); tsr.enable(); ThreadDeathRequest tdr = erm.createThreadDeathRequest(); tdr.enable(); }
Example #7
Source File: VMConnection.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
private void setEventRequests(VirtualMachine vm) { EventRequestManager erm = vm.eventRequestManager(); // Normally, we want all uncaught exceptions. We request them // via the same mechanism as Commands.commandCatchException() // so the user can ignore them later if they are not // interested. // FIXME: this works but generates spurious messages on stdout // during startup: // Set uncaught java.lang.Throwable // Set deferred uncaught java.lang.Throwable Commands evaluator = new Commands(); evaluator.commandCatchException (new StringTokenizer("uncaught java.lang.Throwable")); ThreadStartRequest tsr = erm.createThreadStartRequest(); tsr.enable(); ThreadDeathRequest tdr = erm.createThreadDeathRequest(); tdr.enable(); }
Example #8
Source File: VMConnection.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
private void setEventRequests(VirtualMachine vm) { EventRequestManager erm = vm.eventRequestManager(); // Normally, we want all uncaught exceptions. We request them // via the same mechanism as Commands.commandCatchException() // so the user can ignore them later if they are not // interested. // FIXME: this works but generates spurious messages on stdout // during startup: // Set uncaught java.lang.Throwable // Set deferred uncaught java.lang.Throwable Commands evaluator = new Commands(); evaluator.commandCatchException (new StringTokenizer("uncaught java.lang.Throwable")); ThreadStartRequest tsr = erm.createThreadStartRequest(); tsr.enable(); ThreadDeathRequest tdr = erm.createThreadDeathRequest(); tdr.enable(); }
Example #9
Source File: HotSwapperJpda.java From HotswapAgent with GNU General Public License v2.0 | 6 votes |
/** * Connects to the JVM. * * @param port the port number used for the connection to the JVM. */ public HotSwapperJpda(String port) throws IOException, IllegalConnectorArgumentsException { jvm = null; request = null; newClassFiles = null; trigger = new Trigger(); AttachingConnector connector = (AttachingConnector)findConnector("com.sun.jdi.SocketAttach"); Map<String,Connector.Argument> arguments = connector.defaultArguments(); arguments.get("hostname").setValue(HOST_NAME); arguments.get("port").setValue(port); jvm = connector.attach(arguments); EventRequestManager manager = jvm.eventRequestManager(); request = methodEntryRequests(manager, TRIGGER_NAME); }
Example #10
Source File: VMConnection.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
private void setEventRequests(VirtualMachine vm) { EventRequestManager erm = vm.eventRequestManager(); // Normally, we want all uncaught exceptions. We request them // via the same mechanism as Commands.commandCatchException() // so the user can ignore them later if they are not // interested. // FIXME: this works but generates spurious messages on stdout // during startup: // Set uncaught java.lang.Throwable // Set deferred uncaught java.lang.Throwable Commands evaluator = new Commands(); evaluator.commandCatchException (new StringTokenizer("uncaught java.lang.Throwable")); ThreadStartRequest tsr = erm.createThreadStartRequest(); tsr.enable(); ThreadDeathRequest tdr = erm.createThreadDeathRequest(); tdr.enable(); }
Example #11
Source File: DebugUtility.java From java-debug with Eclipse Public License 1.0 | 6 votes |
/** * Suspend the main thread when the program enters the main method of the specified main class. * @param debugSession * the debug session. * @param mainClass * the fully qualified name of the main class. * @return * a {@link CompletableFuture} that contains the suspended main thread id. */ public static CompletableFuture<Long> stopOnEntry(IDebugSession debugSession, String mainClass) { CompletableFuture<Long> future = new CompletableFuture<>(); EventRequestManager manager = debugSession.getVM().eventRequestManager(); MethodEntryRequest request = manager.createMethodEntryRequest(); request.addClassFilter(mainClass); request.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD); debugSession.getEventHub().events().filter(debugEvent -> { return debugEvent.event instanceof MethodEntryEvent && request.equals(debugEvent.event.request()); }).subscribe(debugEvent -> { Method method = ((MethodEntryEvent) debugEvent.event).method(); if (method.isPublic() && method.isStatic() && method.name().equals("main") && method.signature().equals("([Ljava/lang/String;)V")) { deleteEventRequestSafely(debugSession.getVM().eventRequestManager(), request); debugEvent.shouldResume = false; ThreadReference bpThread = ((MethodEntryEvent) debugEvent.event).thread(); future.complete(bpThread.uniqueID()); } }); request.enable(); return future; }
Example #12
Source File: DynamothCollector.java From astor with GNU General Public License v2.0 | 6 votes |
private void processClassPrepareEvent() throws AbsentInformationException { EventRequestManager erm = vm.eventRequestManager(); List<ReferenceType> referenceTypes = vm.classesByName(this.location.getContainingClassName()); // List listOfLocations = // referenceTypes.get(0).locationsOfLine(this.location.getLineNumber()); int loc = this.location.getLineNumber(); List listOfLocations = null; do { listOfLocations = referenceTypes.get(0).locationsOfLine(loc); loc--; } while (loc > 0 && listOfLocations.isEmpty()); if (listOfLocations.size() == 0) { throw new RuntimeException("Buggy class not found " + this.location); } com.sun.jdi.Location jdiLocation = (com.sun.jdi.Location) listOfLocations.get(0); this.buggyMethod = jdiLocation.method().name(); breakpointSuspicious = erm.createBreakpointRequest(jdiLocation); breakpointSuspicious.setEnabled(true); initSpoon(); this.initExecutionTime = System.currentTimeMillis(); }
Example #13
Source File: VMConnection.java From hottub with GNU General Public License v2.0 | 6 votes |
private void setEventRequests(VirtualMachine vm) { EventRequestManager erm = vm.eventRequestManager(); // Normally, we want all uncaught exceptions. We request them // via the same mechanism as Commands.commandCatchException() // so the user can ignore them later if they are not // interested. // FIXME: this works but generates spurious messages on stdout // during startup: // Set uncaught java.lang.Throwable // Set deferred uncaught java.lang.Throwable Commands evaluator = new Commands(); evaluator.commandCatchException (new StringTokenizer("uncaught java.lang.Throwable")); ThreadStartRequest tsr = erm.createThreadStartRequest(); tsr.enable(); ThreadDeathRequest tdr = erm.createThreadDeathRequest(); tdr.enable(); }
Example #14
Source File: VMConnection.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
private void setEventRequests(VirtualMachine vm) { EventRequestManager erm = vm.eventRequestManager(); // Normally, we want all uncaught exceptions. We request them // via the same mechanism as Commands.commandCatchException() // so the user can ignore them later if they are not // interested. // FIXME: this works but generates spurious messages on stdout // during startup: // Set uncaught java.lang.Throwable // Set deferred uncaught java.lang.Throwable Commands evaluator = new Commands(); evaluator.commandCatchException (new StringTokenizer("uncaught java.lang.Throwable")); ThreadStartRequest tsr = erm.createThreadStartRequest(); tsr.enable(); ThreadDeathRequest tdr = erm.createThreadDeathRequest(); tdr.enable(); }
Example #15
Source File: VMConnection.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
private void setEventRequests(VirtualMachine vm) { EventRequestManager erm = vm.eventRequestManager(); // Normally, we want all uncaught exceptions. We request them // via the same mechanism as Commands.commandCatchException() // so the user can ignore them later if they are not // interested. // FIXME: this works but generates spurious messages on stdout // during startup: // Set uncaught java.lang.Throwable // Set deferred uncaught java.lang.Throwable Commands evaluator = new Commands(); evaluator.commandCatchException (new StringTokenizer("uncaught java.lang.Throwable")); ThreadStartRequest tsr = erm.createThreadStartRequest(); tsr.enable(); ThreadDeathRequest tdr = erm.createThreadDeathRequest(); tdr.enable(); }
Example #16
Source File: VMConnection.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
private void setEventRequests(VirtualMachine vm) { EventRequestManager erm = vm.eventRequestManager(); // Normally, we want all uncaught exceptions. We request them // via the same mechanism as Commands.commandCatchException() // so the user can ignore them later if they are not // interested. // FIXME: this works but generates spurious messages on stdout // during startup: // Set uncaught java.lang.Throwable // Set deferred uncaught java.lang.Throwable Commands evaluator = new Commands(); evaluator.commandCatchException (new StringTokenizer("uncaught java.lang.Throwable")); ThreadStartRequest tsr = erm.createThreadStartRequest(); tsr.enable(); ThreadDeathRequest tdr = erm.createThreadDeathRequest(); tdr.enable(); }
Example #17
Source File: ModificationWatchpointSpec.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
/** * The 'refType' is known to match, return the EventRequest. */ @Override EventRequest resolveEventRequest(ReferenceType refType) throws NoSuchFieldException { Field field = refType.fieldByName(fieldId); EventRequestManager em = refType.virtualMachine().eventRequestManager(); EventRequest wp = em.createModificationWatchpointRequest(field); wp.setSuspendPolicy(suspendPolicy); wp.enable(); return wp; }
Example #18
Source File: ModificationWatchpointSpec.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * The 'refType' is known to match, return the EventRequest. */ @Override EventRequest resolveEventRequest(ReferenceType refType) throws NoSuchFieldException { Field field = refType.fieldByName(fieldId); EventRequestManager em = refType.virtualMachine().eventRequestManager(); EventRequest wp = em.createModificationWatchpointRequest(field); wp.setSuspendPolicy(suspendPolicy); wp.enable(); return wp; }
Example #19
Source File: DebugUtility.java From java-debug with Eclipse Public License 1.0 | 5 votes |
/** * Remove the event request from the vm. If the vm has terminated, do nothing. * @param eventManager * The event request manager. * @param request * The target event request. */ public static void deleteEventRequestSafely(EventRequestManager eventManager, EventRequest request) { try { eventManager.deleteEventRequest(request); } catch (VMDisconnectedException ex) { // ignore. } }
Example #20
Source File: FieldMonitor.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private static void addClassWatch(VirtualMachine vm) { EventRequestManager erm = vm.eventRequestManager(); ClassPrepareRequest classPrepareRequest = erm .createClassPrepareRequest(); classPrepareRequest.addClassFilter(CLASS_NAME); classPrepareRequest.setEnabled(true); }
Example #21
Source File: DebugSession.java From java-debug with Eclipse Public License 1.0 | 5 votes |
@Override public void setExceptionBreakpoints(boolean notifyCaught, boolean notifyUncaught, String[] classFilters, String[] classExclusionFilters) { EventRequestManager manager = vm.eventRequestManager(); ArrayList<ExceptionRequest> legacy = new ArrayList<>(manager.exceptionRequests()); manager.deleteEventRequests(legacy); // When no exception breakpoints are requested, no need to create an empty exception request. if (notifyCaught || notifyUncaught) { // from: https://www.javatips.net/api/REPLmode-master/src/jm/mode/replmode/REPLRunner.java // Calling this seems to set something internally to make the // Eclipse JDI wake up. Without it, an ObjectCollectedException // is thrown on request.enable(). No idea why this works, // but at least exception handling has returned. (Suspect that it may // block until all or at least some threads are available, meaning // that the app has launched and we have legit objects to talk to). vm.allThreads(); // The bug may not have been noticed because the test suite waits for // a thread to be available, and queries it by calling allThreads(). // See org.eclipse.debug.jdi.tests.AbstractJDITest for the example. // get only the uncaught exceptions ExceptionRequest request = manager.createExceptionRequest(null, notifyCaught, notifyUncaught); request.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD); if (classFilters != null) { for (String classFilter : classFilters) { request.addClassFilter(classFilter); } } if (classExclusionFilters != null) { for (String exclusionFilter : classExclusionFilters) { request.addClassExclusionFilter(exclusionFilter); } } request.enable(); } }
Example #22
Source File: ModificationWatchpointSpec.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * The 'refType' is known to match, return the EventRequest. */ @Override EventRequest resolveEventRequest(ReferenceType refType) throws NoSuchFieldException { Field field = refType.fieldByName(fieldId); EventRequestManager em = refType.virtualMachine().eventRequestManager(); EventRequest wp = em.createModificationWatchpointRequest(field); wp.setSuspendPolicy(suspendPolicy); wp.enable(); return wp; }
Example #23
Source File: FieldMonitor.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private static void addClassWatch(VirtualMachine vm) { EventRequestManager erm = vm.eventRequestManager(); ClassPrepareRequest classPrepareRequest = erm .createClassPrepareRequest(); classPrepareRequest.addClassFilter(CLASS_NAME); classPrepareRequest.setEnabled(true); }
Example #24
Source File: ModificationWatchpointSpec.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * The 'refType' is known to match, return the EventRequest. */ @Override EventRequest resolveEventRequest(ReferenceType refType) throws NoSuchFieldException { Field field = refType.fieldByName(fieldId); EventRequestManager em = refType.virtualMachine().eventRequestManager(); EventRequest wp = em.createModificationWatchpointRequest(field); wp.setSuspendPolicy(suspendPolicy); wp.enable(); return wp; }
Example #25
Source File: GetObjectLockCount.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private static void addClassWatch(VirtualMachine vm) { EventRequestManager erm = vm.eventRequestManager(); ClassPrepareRequest classPrepareRequest = erm .createClassPrepareRequest(); classPrepareRequest.addClassFilter(CLASS_NAME); classPrepareRequest.setEnabled(true); }
Example #26
Source File: ModificationWatchpointSpec.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * The 'refType' is known to match, return the EventRequest. */ @Override EventRequest resolveEventRequest(ReferenceType refType) throws NoSuchFieldException { Field field = refType.fieldByName(fieldId); EventRequestManager em = refType.virtualMachine().eventRequestManager(); EventRequest wp = em.createModificationWatchpointRequest(field); wp.setSuspendPolicy(suspendPolicy); wp.enable(); return wp; }
Example #27
Source File: ModificationWatchpointSpec.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * The 'refType' is known to match, return the EventRequest. */ @Override EventRequest resolveEventRequest(ReferenceType refType) throws NoSuchFieldException { Field field = refType.fieldByName(fieldId); EventRequestManager em = refType.virtualMachine().eventRequestManager(); EventRequest wp = em.createModificationWatchpointRequest(field); wp.setSuspendPolicy(suspendPolicy); wp.enable(); return wp; }
Example #28
Source File: FieldMonitor.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private static void addFieldWatch(VirtualMachine vm, ReferenceType refType) { EventRequestManager erm = vm.eventRequestManager(); Field field = refType.fieldByName(FIELD_NAME); ModificationWatchpointRequest modificationWatchpointRequest = erm .createModificationWatchpointRequest(field); modificationWatchpointRequest.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD); modificationWatchpointRequest.setEnabled(true); }
Example #29
Source File: FieldMonitor.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private static void addClassWatch(VirtualMachine vm) { EventRequestManager erm = vm.eventRequestManager(); ClassPrepareRequest classPrepareRequest = erm .createClassPrepareRequest(); classPrepareRequest.addClassFilter(CLASS_NAME); classPrepareRequest.setEnabled(true); }
Example #30
Source File: ModificationWatchpointSpec.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * The 'refType' is known to match, return the EventRequest. */ @Override EventRequest resolveEventRequest(ReferenceType refType) throws NoSuchFieldException { Field field = refType.fieldByName(fieldId); EventRequestManager em = refType.virtualMachine().eventRequestManager(); EventRequest wp = em.createModificationWatchpointRequest(field); wp.setSuspendPolicy(suspendPolicy); wp.enable(); return wp; }