From af114e3211933a08ed14d4a1dba768a3f98c897b Mon Sep 17 00:00:00 2001 From: Vladimir Ilmov Date: Wed, 13 May 2020 10:33:04 +0200 Subject: [PATCH] (CoroutineDebugger) 192/193 compatibility fix --- .../coroutine/data/coroutineStackFrames.kt | 10 +-- .../data/coroutineStackFrames.kt.192 | 89 ------------------- 2 files changed, 4 insertions(+), 95 deletions(-) delete mode 100644 idea/jvm-debugger/jvm-debugger-coroutine/src/org/jetbrains/kotlin/idea/debugger/coroutine/data/coroutineStackFrames.kt.192 diff --git a/idea/jvm-debugger/jvm-debugger-coroutine/src/org/jetbrains/kotlin/idea/debugger/coroutine/data/coroutineStackFrames.kt b/idea/jvm-debugger/jvm-debugger-coroutine/src/org/jetbrains/kotlin/idea/debugger/coroutine/data/coroutineStackFrames.kt index 2688e6b10d6..0b862a7d78b 100644 --- a/idea/jvm-debugger/jvm-debugger-coroutine/src/org/jetbrains/kotlin/idea/debugger/coroutine/data/coroutineStackFrames.kt +++ b/idea/jvm-debugger/jvm-debugger-coroutine/src/org/jetbrains/kotlin/idea/debugger/coroutine/data/coroutineStackFrames.kt @@ -6,8 +6,7 @@ package org.jetbrains.kotlin.idea.debugger.coroutine.data import com.intellij.debugger.engine.DebugProcessImpl import com.intellij.debugger.engine.JVMStackFrameInfoProvider -import com.intellij.debugger.impl.DebuggerContextImpl -import com.intellij.debugger.jdi.LocalVariableProxyImpl +import com.intellij.debugger.engine.evaluation.EvaluationContextImpl import com.intellij.debugger.jdi.StackFrameProxyImpl import com.intellij.debugger.memory.utils.StackFrameItem import com.intellij.debugger.ui.impl.watch.StackFrameDescriptorImpl @@ -34,10 +33,9 @@ class CoroutinePreflightStackFrame( private val firstFrameVariables: List = coroutineInfoData.topFrameVariables() ) : KotlinStackFrame(stackFrameDescriptorImpl), JVMStackFrameInfoProvider { - override fun buildVariablesThreadAction(debuggerContext: DebuggerContextImpl?, children: XValueChildrenList?, node: XCompositeNode?) { - super.buildVariablesThreadAction(debuggerContext, children, node) - // add vars from first restored frame if no local vars found - children?.let { + override fun superBuildVariables(evaluationContext: EvaluationContextImpl, children: XValueChildrenList) { + super.superBuildVariables(evaluationContext, children) + children.let { val varNames = (0 until children.size()).map { children.getName(it) }.toSet() firstFrameVariables.forEach { if (!varNames.contains(it.name)) diff --git a/idea/jvm-debugger/jvm-debugger-coroutine/src/org/jetbrains/kotlin/idea/debugger/coroutine/data/coroutineStackFrames.kt.192 b/idea/jvm-debugger/jvm-debugger-coroutine/src/org/jetbrains/kotlin/idea/debugger/coroutine/data/coroutineStackFrames.kt.192 deleted file mode 100644 index df316d2d2e2..00000000000 --- a/idea/jvm-debugger/jvm-debugger-coroutine/src/org/jetbrains/kotlin/idea/debugger/coroutine/data/coroutineStackFrames.kt.192 +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ -package org.jetbrains.kotlin.idea.debugger.coroutine.data - -import com.intellij.debugger.engine.DebugProcessImpl -import com.intellij.debugger.engine.JVMStackFrameInfoProvider -import com.intellij.debugger.jdi.LocalVariableProxyImpl -import com.intellij.debugger.jdi.StackFrameProxyImpl -import com.intellij.debugger.memory.utils.StackFrameItem -import com.intellij.debugger.ui.impl.watch.StackFrameDescriptorImpl -import com.intellij.xdebugger.frame.XCompositeNode -import com.intellij.xdebugger.frame.XNamedValue -import com.intellij.xdebugger.frame.XStackFrame -import com.intellij.xdebugger.frame.XValueChildrenList -import org.jetbrains.kotlin.idea.debugger.coroutine.KotlinDebuggerCoroutinesBundle -import org.jetbrains.kotlin.idea.debugger.stackFrame.KotlinStackFrame - - -/** - * Coroutine exit frame represented by a stack frames - * invokeSuspend():-1 - * resumeWith() - * - */ - -class CoroutinePreflightStackFrame( - val coroutineInfoData: CoroutineInfoData, - private val stackFrameDescriptorImpl: StackFrameDescriptorImpl, - val threadPreCoroutineFrames: List, - val mode: SuspendExitMode, - private val firstFrameVariables: List = coroutineInfoData.topFrameVariables() -) : KotlinStackFrame(stackFrameDescriptorImpl), JVMStackFrameInfoProvider { - - override fun computeChildren(node: XCompositeNode) { - val childrenList = XValueChildrenList() - firstFrameVariables.forEach { - childrenList.add(it) - } - node.addChildren(childrenList, false) - super.computeChildren(node) - } - - override fun getVisibleVariables(): List { - // skip restored variables - return super.getVisibleVariables().filter { v -> !firstFrameVariables.any { it.name == v.name() } } - } - - override fun isInLibraryContent() = false - - override fun isSynthetic() = false - - fun restoredStackTrace() = - coroutineInfoData.restoredStackTrace(mode) -} - -enum class SuspendExitMode { - SUSPEND_LAMBDA, SUSPEND_METHOD_PARAMETER, SUSPEND_METHOD, UNKNOWN, NONE; - - fun isCoroutineFound() = - this == SUSPEND_LAMBDA || this == SUSPEND_METHOD_PARAMETER - - fun isSuspendMethodParameter() = - this == SUSPEND_METHOD_PARAMETER -} - -class CreationCoroutineStackFrame(debugProcess: DebugProcessImpl, item: StackFrameItem) : CoroutineStackFrame(debugProcess, item) { - override fun getCaptionAboveOf() = KotlinDebuggerCoroutinesBundle.message("coroutine.dump.creation.trace") - - override fun hasSeparatorAbove(): Boolean = - true -} - -open class CoroutineStackFrame(debugProcess: DebugProcessImpl, val item: StackFrameItem, private val realStackFrame: XStackFrame? = null) : - StackFrameItem.CapturedStackFrame(debugProcess, item) { - - override fun computeChildren(node: XCompositeNode) { - if (realStackFrame != null) - realStackFrame.computeChildren(node) - else - super.computeChildren(node) - } - - override fun getCaptionAboveOf() = "CoroutineExit" - - override fun hasSeparatorAbove(): Boolean = - false -} \ No newline at end of file