[debugger] Check isInSuspendCommand in isEvaluationPossible

GitOrigin-RevId: 2de5dc5741d80242fd70e68fec672782b7f53fcc
This commit is contained in:
Maksim Zuev
2025-02-14 10:04:28 +01:00
committed by intellij-monorepo-bot
parent 4de1676530
commit d40069a7cb
3 changed files with 10 additions and 4 deletions

View File

@@ -2803,8 +2803,15 @@ public abstract class DebugProcessImpl extends UserDataHolderBase implements Deb
|| DebuggerImplicitEvaluationContextUtil.getImplicitEvaluationThread(this) != null;
}
public static boolean isInSuspendCommand(SuspendContextImpl suspendContext) {
DebuggerManagerThreadImpl.assertIsManagerThread();
DebuggerCommandImpl command = DebuggerManagerThreadImpl.getCurrentCommand();
return command instanceof SuspendContextCommandImpl suspendContextCommand
&& suspendContextCommand.getSuspendContext() == suspendContext;
}
public boolean isEvaluationPossible(SuspendContextImpl suspendContext) {
return mySuspendManager.hasPausedContext(suspendContext);
return isInSuspendCommand(suspendContext) && mySuspendManager.hasPausedContext(suspendContext);
}
public void startWatchingMethodReturn(ThreadReferenceProxyImpl thread) {

View File

@@ -572,8 +572,7 @@ public abstract class ExecutionWithDebuggerToolsTestCase extends ExecutionTestCa
@Override
public void paused(SuspendContextImpl suspendContext) {
// Need to add SuspendContextCommandImpl because the stepping pause is not now in SuspendContextCommandImpl
if (suspendContext.myInProgress) { // already inside SuspendContextCommand
assertTrue(DebuggerManagerThreadImpl.getCurrentCommand() instanceof SuspendContextCommandImpl);
if (DebugProcessImpl.isInSuspendCommand(suspendContext)) {
pausedImpl(suspendContext);
}
else {

View File

@@ -150,7 +150,7 @@ private fun initializeThreadState(suspendContext: SuspendContextImpl): ObjectRef
private fun booleanValue(suspendContext: SuspendContextImpl, b: Boolean): BooleanValue = suspendContext.virtualMachineProxy.mirrorOf(b)
private fun <T> invokeInSuspendCommand(suspendContext: SuspendContextImpl, action: () -> T): T? {
if (DebuggerManagerThreadImpl.getCurrentCommand() is SuspendContextCommandImpl) {
if (DebugProcessImpl.isInSuspendCommand(suspendContext)) {
return action()
}
var result: T? = null