use of com.intellij.debugger.jdi.ThreadReferenceProxyImpl in project intellij-community by JetBrains.
the class SuspendManagerUtil method prepareForResume.
public static Object prepareForResume(SuspendContextImpl context) {
SuspendManager suspendManager = context.getDebugProcess().getSuspendManager();
ThreadReferenceProxyImpl thread = context.getThread();
ResumeData resumeData = new ResumeData(suspendManager.isFrozen(thread), context.myResumedThreads);
if (resumeData.myIsFrozen) {
suspendManager.unfreezeThread(thread);
}
LOG.debug("Resuming SuspendContextImpl...");
if (context.myResumedThreads != null) {
context.myResumedThreads.forEach(ThreadReferenceProxyImpl::suspend);
context.myResumedThreads = null;
}
return resumeData;
}
use of com.intellij.debugger.jdi.ThreadReferenceProxyImpl in project intellij-community by JetBrains.
the class SuspendManagerUtil method restoreAfterResume.
public static void restoreAfterResume(SuspendContextImpl context, Object resumeData) {
SuspendManager suspendManager = context.getDebugProcess().getSuspendManager();
ResumeData data = (ResumeData) resumeData;
ThreadReferenceProxyImpl thread = context.getThread();
if (data.myIsFrozen && !suspendManager.isFrozen(thread)) {
suspendManager.freezeThread(thread);
}
LOG.debug("RestoreAfterResume SuspendContextImpl...");
LOG.assertTrue(context.myResumedThreads == null);
if (data.myResumedThreads != null) {
data.myResumedThreads.forEach(ThreadReferenceProxyImpl::resume);
context.myResumedThreads = data.myResumedThreads;
}
}
use of com.intellij.debugger.jdi.ThreadReferenceProxyImpl in project intellij-community by JetBrains.
the class ThreadBlockedMonitor method onThreadBlocked.
private static void onThreadBlocked(@NotNull final ThreadReference blockedThread, @NotNull final ThreadReference blockingThread, final DebugProcessImpl process) {
XDebugSessionImpl.NOTIFICATION_GROUP.createNotification(DebuggerBundle.message("status.thread.blocked.by", blockedThread.name(), blockingThread.name()), DebuggerBundle.message("status.thread.blocked.by.resume", blockingThread.name()), NotificationType.INFORMATION, (notification, event) -> {
if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
notification.expire();
process.getManagerThread().schedule(new DebuggerCommandImpl() {
@Override
protected void action() throws Exception {
ThreadReferenceProxyImpl threadProxy = process.getVirtualMachineProxy().getThreadReferenceProxy(blockingThread);
SuspendContextImpl suspendingContext = SuspendManagerUtil.getSuspendingContext(process.getSuspendManager(), threadProxy);
process.getManagerThread().invoke(process.createResumeThreadCommand(suspendingContext, threadProxy));
}
});
}
}).notify(process.getProject());
}
use of com.intellij.debugger.jdi.ThreadReferenceProxyImpl in project intellij-community by JetBrains.
the class DebugProcessEvents method processStepEvent.
private void processStepEvent(SuspendContextImpl suspendContext, StepEvent event) {
final ThreadReference thread = event.thread();
//LOG.assertTrue(thread.isSuspended());
preprocessEvent(suspendContext, thread);
//noinspection HardCodedStringLiteral
RequestHint hint = (RequestHint) event.request().getProperty("hint");
deleteStepRequests(event.thread());
boolean shouldResume = false;
final Project project = getProject();
if (hint != null) {
final int nextStepDepth = hint.getNextStepDepth(suspendContext);
if (nextStepDepth == RequestHint.RESUME) {
getSession().clearSteppingThrough();
shouldResume = true;
} else if (nextStepDepth != RequestHint.STOP) {
final ThreadReferenceProxyImpl threadProxy = suspendContext.getThread();
doStep(suspendContext, threadProxy, hint.getSize(), nextStepDepth, hint);
shouldResume = true;
}
if (!shouldResume && hint.isRestoreBreakpoints()) {
DebuggerManagerEx.getInstanceEx(project).getBreakpointManager().enableBreakpoints(this);
}
}
if (shouldResume) {
getSuspendManager().voteResume(suspendContext);
} else {
showStatusText("");
if (myReturnValueWatcher != null) {
myReturnValueWatcher.disable();
}
getSuspendManager().voteSuspend(suspendContext);
if (hint != null) {
final MethodFilter methodFilter = hint.getMethodFilter();
if (methodFilter instanceof NamedMethodFilter && !hint.wasStepTargetMethodMatched()) {
final String message = "Method <b>" + ((NamedMethodFilter) methodFilter).getMethodName() + "()</b> has not been called";
XDebugSessionImpl.NOTIFICATION_GROUP.createNotification(message, MessageType.INFO).notify(project);
}
if (hint.wasStepTargetMethodMatched() && hint.isResetIgnoreFilters()) {
checkPositionNotFiltered(suspendContext.getThread(), filters -> mySession.resetIgnoreStepFiltersFlag());
}
}
}
}
use of com.intellij.debugger.jdi.ThreadReferenceProxyImpl in project intellij-community by JetBrains.
the class DebuggerContextCommandImpl method getSuspendContext.
@Nullable
@Override
public SuspendContextImpl getSuspendContext() {
if (myCustomSuspendContext == null) {
myCustomSuspendContext = super.getSuspendContext();
ThreadReferenceProxyImpl thread = getThread();
if (myCustomThread != null && (myCustomSuspendContext == null || myCustomSuspendContext.isResumed() || !myCustomSuspendContext.suspends(thread))) {
myCustomSuspendContext = SuspendManagerUtil.findContextByThread(myDebuggerContext.getDebugProcess().getSuspendManager(), thread);
}
}
return myCustomSuspendContext;
}
Aggregations