diff --git a/idea/src/org/jetbrains/kotlin/idea/debugger/stepping/KotlinSteppingCommandProvider.kt b/idea/src/org/jetbrains/kotlin/idea/debugger/stepping/KotlinSteppingCommandProvider.kt index 1aac527c32d..1b2766a0180 100644 --- a/idea/src/org/jetbrains/kotlin/idea/debugger/stepping/KotlinSteppingCommandProvider.kt +++ b/idea/src/org/jetbrains/kotlin/idea/debugger/stepping/KotlinSteppingCommandProvider.kt @@ -44,6 +44,8 @@ public class KotlinSteppingCommandProvider: JvmSteppingCommandProvider() { ): DebugProcessImpl.ResumeCommand? { if (suspendContext == null) return null + if (!isKotlinStrataPresent(suspendContext)) return null + val result: Pair>? = computeInManagerThread(suspendContext) { val sp = runReadAction { ContextUtil.getSourcePosition(it) } ?: return@computeInManagerThread null val cl = it.debugProcess.positionManager.getAllClasses(sp) @@ -78,6 +80,11 @@ public class KotlinSteppingCommandProvider: JvmSteppingCommandProvider() { return null } + private fun isKotlinStrataPresent(suspendContext: SuspendContextImpl): Boolean { + val availableStrata = suspendContext.frameProxy?.location()?.declaringType()?.availableStrata() ?: return false + return availableStrata.contains("Kotlin") + } + private fun computeInManagerThread(suspendContext: SuspendContextImpl, action: (SuspendContextImpl) -> T?): T? { val semaphore = Semaphore() semaphore.down()