use of com.sun.jdi.request.EventRequestManager in project intellij-community by JetBrains.
the class DebugProcessImpl method deleteStepRequests.
void deleteStepRequests(@Nullable final ThreadReference stepThread) {
EventRequestManager requestManager = getVirtualMachineProxy().eventRequestManager();
List<StepRequest> stepRequests = requestManager.stepRequests();
if (!stepRequests.isEmpty()) {
final List<StepRequest> toDelete = new ArrayList<>(stepRequests.size());
for (final StepRequest request : stepRequests) {
ThreadReference threadReference = request.thread();
// [jeka] on attempt to delete a request assigned to a thread with unknown status, a JDWP error occurs
try {
if (threadReference.status() != ThreadReference.THREAD_STATUS_UNKNOWN && (stepThread == null || stepThread.equals(threadReference))) {
toDelete.add(request);
}
} catch (IllegalThreadStateException e) {
// undocumented by JDI: may be thrown when querying thread status
LOG.info(e);
} catch (ObjectCollectedException ignored) {
}
}
requestManager.deleteEventRequests(toDelete);
}
}
use of com.sun.jdi.request.EventRequestManager in project jdk8u_jdk by JetBrains.
the class ModificationWatchpointSpec method resolveEventRequest.
/**
* 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;
}
use of com.sun.jdi.request.EventRequestManager in project jdk8u_jdk by JetBrains.
the class VMConnection method setEventRequests.
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();
}
use of com.sun.jdi.request.EventRequestManager in project otertool by wuntee.
the class Testing method addIntentBreakpoints.
@SuppressWarnings("restriction")
public static void addIntentBreakpoints(VirtualMachine vm) {
EventRequestManager mgr = vm.eventRequestManager();
com.sun.jdi.ReferenceType intentClass = vm.classesByName("android.content.Intent").get(0);
for (Method m : intentClass.methodsByName("<init>")) {
System.out.println("Breakpoint: " + m.toString());
Location location = m.location();
BreakpointRequest bpr = mgr.createBreakpointRequest(location);
bpr.enable();
}
for (Method m : intentClass.methodsByName("putExtra")) {
System.out.println("Breakpoint: " + m.toString());
Location location = m.location();
BreakpointRequest bpr = mgr.createBreakpointRequest(location);
bpr.enable();
}
}
use of com.sun.jdi.request.EventRequestManager in project intellij-community by JetBrains.
the class DebugProcessEvents method vmAttached.
private void vmAttached() {
DebuggerManagerThreadImpl.assertIsManagerThread();
LOG.assertTrue(!isAttached());
if (myState.compareAndSet(State.INITIAL, State.ATTACHED)) {
final VirtualMachineProxyImpl machineProxy = getVirtualMachineProxy();
final EventRequestManager requestManager = machineProxy.eventRequestManager();
if (machineProxy.canGetMethodReturnValues()) {
myReturnValueWatcher = new MethodReturnValueWatcher(requestManager);
}
final ThreadStartRequest threadStartRequest = requestManager.createThreadStartRequest();
threadStartRequest.setSuspendPolicy(EventRequest.SUSPEND_NONE);
threadStartRequest.enable();
final ThreadDeathRequest threadDeathRequest = requestManager.createThreadDeathRequest();
threadDeathRequest.setSuspendPolicy(EventRequest.SUSPEND_NONE);
threadDeathRequest.enable();
// fill position managers
((DebuggerManagerImpl) DebuggerManager.getInstance(getProject())).getCustomPositionManagerFactories().map(factory -> factory.fun(this)).filter(Objects::nonNull).forEach(this::appendPositionManager);
Stream.of(Extensions.getExtensions(PositionManagerFactory.EP_NAME, getProject())).map(factory -> factory.createPositionManager(this)).filter(Objects::nonNull).forEach(this::appendPositionManager);
myDebugProcessDispatcher.getMulticaster().processAttached(this);
createStackCapturingBreakpoints();
// breakpoints should be initialized after all processAttached listeners work
ApplicationManager.getApplication().runReadAction(() -> {
XDebugSession session = getSession().getXDebugSession();
if (session != null) {
session.initBreakpoints();
}
});
final String addressDisplayName = DebuggerBundle.getAddressDisplayName(getConnection());
final String transportName = DebuggerBundle.getTransportName(getConnection());
showStatusText(DebuggerBundle.message("status.connected", addressDisplayName, transportName));
LOG.debug("leave: processVMStartEvent()");
}
}
Aggregations