diff --git a/java/testFramework/src/com/intellij/debugger/ExecutionWithDebuggerToolsTestCase.java b/java/testFramework/src/com/intellij/debugger/ExecutionWithDebuggerToolsTestCase.java index fd830adc470c..12f05d321a8a 100644 --- a/java/testFramework/src/com/intellij/debugger/ExecutionWithDebuggerToolsTestCase.java +++ b/java/testFramework/src/com/intellij/debugger/ExecutionWithDebuggerToolsTestCase.java @@ -577,6 +577,17 @@ 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 + DebuggerManagerThreadImpl debuggerManagerThread = Objects.requireNonNull(suspendContext.getDebugProcess()).getManagerThread(); + debuggerManagerThread.schedule(new SuspendContextCommandImpl(suspendContext) { + @Override + public void contextAction(@NotNull SuspendContextImpl suspendContext) { + pausedImpl(suspendContext); + } + }); + } + + private void pausedImpl(SuspendContextImpl suspendContext) { try { if (myScriptRunnables.isEmpty() && myRepeatingRunnables.isEmpty()) { print("resuming ", ProcessOutputTypes.SYSTEM); diff --git a/plugins/kotlin/jvm-debugger/test/test/org/jetbrains/kotlin/idea/debugger/test/AbstractIrKotlinEvaluateExpressionTest.kt b/plugins/kotlin/jvm-debugger/test/test/org/jetbrains/kotlin/idea/debugger/test/AbstractIrKotlinEvaluateExpressionTest.kt index b6ef32ed71c4..44c69b79a647 100644 --- a/plugins/kotlin/jvm-debugger/test/test/org/jetbrains/kotlin/idea/debugger/test/AbstractIrKotlinEvaluateExpressionTest.kt +++ b/plugins/kotlin/jvm-debugger/test/test/org/jetbrains/kotlin/idea/debugger/test/AbstractIrKotlinEvaluateExpressionTest.kt @@ -9,6 +9,7 @@ import com.intellij.debugger.engine.evaluation.CodeFragmentKind import com.intellij.debugger.engine.evaluation.EvaluateException import com.intellij.debugger.engine.evaluation.TextWithImportsImpl import com.intellij.debugger.engine.evaluation.expression.EvaluatorBuilderImpl +import com.intellij.debugger.engine.events.SuspendContextCommandImpl import com.intellij.debugger.impl.DebuggerContextImpl import com.intellij.debugger.impl.DebuggerContextImpl.createDebuggerContext import com.intellij.debugger.impl.DebuggerUtilsImpl @@ -199,7 +200,13 @@ abstract class AbstractIrKotlinEvaluateExpressionTest : KotlinDescriptorTestCase val result = FramePrinter(suspendContext).print(stackFrame) print(result, ProcessOutputTypes.SYSTEM) } - suspendContext.invokeInManagerThread(completion) + assert(debugProcess.isAttached) + debugProcess.managerThread.schedule(object : SuspendContextCommandImpl(suspendContext) { + override fun contextAction(suspendContext: SuspendContextImpl) { + completion() + } + override fun commandCancelled() = error(message = "Test was cancelled") + }) } } diff --git a/plugins/kotlin/jvm-debugger/test/test/org/jetbrains/kotlin/idea/debugger/test/KotlinDescriptorTestCaseWithStepping.kt b/plugins/kotlin/jvm-debugger/test/test/org/jetbrains/kotlin/idea/debugger/test/KotlinDescriptorTestCaseWithStepping.kt index b871c51850f9..07f0bb1bd631 100644 --- a/plugins/kotlin/jvm-debugger/test/test/org/jetbrains/kotlin/idea/debugger/test/KotlinDescriptorTestCaseWithStepping.kt +++ b/plugins/kotlin/jvm-debugger/test/test/org/jetbrains/kotlin/idea/debugger/test/KotlinDescriptorTestCaseWithStepping.kt @@ -11,7 +11,6 @@ import com.intellij.debugger.engine.SuspendContextImpl import com.intellij.debugger.engine.evaluation.EvaluateException import com.intellij.debugger.engine.evaluation.EvaluationContextImpl import com.intellij.debugger.engine.events.SuspendContextCommandImpl -import com.intellij.debugger.engine.managerThread.DebuggerCommand import com.intellij.debugger.impl.DebuggerContextImpl import com.intellij.debugger.impl.JvmSteppingCommandProvider import com.intellij.debugger.impl.PositionUtil @@ -371,14 +370,6 @@ abstract class KotlinDescriptorTestCaseWithStepping : KotlinDescriptorTestCase() protected fun countBreakpointsNumber(file: KotlinBaseTest.TestFile) = InTextDirectivesUtils.findLinesWithPrefixesRemoved(file.content, "//Breakpoint!").size - protected fun SuspendContextImpl.invokeInManagerThread(callback: () -> Unit) { - assert(debugProcess.isAttached) - debugProcess.managerThread.invokeCommand(object : DebuggerCommand { - override fun action() = callback() - override fun commandCancelled() = error(message = "Test was cancelled") - }) - } - override fun addMavenDependency(compilerFacility: DebuggerTestCompilerFacility, library: String) { addMavenDependency(compilerFacility, library, module) processAgentDependencies(library, compilerFacility)