(CoroutineDebugger) Restored frame variables isn't shown for 2020.1.
#KT-40172 fixed
This commit is contained in:
+10
-1
@@ -51,7 +51,16 @@ class SuspendCoroutineStackFrameItem(
|
||||
val stackTraceElement: StackTraceElement,
|
||||
location: Location,
|
||||
spilledVariables: List<XNamedValue> = emptyList()
|
||||
) : CoroutineStackFrameItem(location, spilledVariables)
|
||||
) : CoroutineStackFrameItem(location, spilledVariables) {
|
||||
override fun createFrame(debugProcess: DebugProcessImpl): XStackFrame? {
|
||||
return debugProcess.invokeInManagerThread {
|
||||
val frame = debugProcess.findFirstFrame() ?: return@invokeInManagerThread null
|
||||
val locationFrame = LocationStackFrameProxyImpl(location, frame)
|
||||
val position = location.findPosition(debugProcess.project)
|
||||
CoroutineStackFrame(locationFrame, position, spilledVariables, includeFrameVariables = false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
||||
+13
-6
@@ -6,6 +6,7 @@
|
||||
package org.jetbrains.kotlin.idea.debugger.coroutine.proxy
|
||||
|
||||
import com.intellij.xdebugger.frame.XNamedValue
|
||||
import com.sun.jdi.ObjectReference
|
||||
import org.jetbrains.kotlin.idea.debugger.coroutine.data.CoroutineInfoData
|
||||
import org.jetbrains.kotlin.idea.debugger.coroutine.data.CoroutineNameIdState
|
||||
import org.jetbrains.kotlin.idea.debugger.coroutine.data.CreationCoroutineStackFrameItem
|
||||
@@ -32,11 +33,7 @@ class CoroutineLibraryAgent2Proxy(private val executionContext: DefaultExecution
|
||||
private fun mapToCoroutineInfoData(mirror: MirrorOfCoroutineInfo): CoroutineInfoData? {
|
||||
val coroutineNameIdState = CoroutineNameIdState.instance(mirror)
|
||||
val stackTrace = mirror.enhancedStackTrace?.mapNotNull { it.stackTraceElement() } ?: emptyList()
|
||||
val variables: List<XNamedValue> = mirror.lastObservedFrame?.let {
|
||||
val spilledVariables = debugMetadata?.baseContinuationImpl?.mirror(it, executionContext)
|
||||
spilledVariables?.spilledValues(executionContext)
|
||||
} ?: emptyList()
|
||||
val stackFrames = findStackFrames(stackTrace, variables)
|
||||
val stackFrames = findStackFrames(stackTrace, mirror.lastObservedFrame)
|
||||
return CoroutineInfoData(
|
||||
coroutineNameIdState,
|
||||
stackFrames.restoredStackFrames,
|
||||
@@ -57,14 +54,24 @@ class CoroutineLibraryAgent2Proxy(private val executionContext: DefaultExecution
|
||||
|
||||
private fun findStackFrames(
|
||||
frames: List<StackTraceElement>,
|
||||
variables: List<XNamedValue>
|
||||
lastObservedFrame: ObjectReference?
|
||||
): CoroutineStackFrames {
|
||||
val index = frames.indexOfFirst { it.isCreationSeparatorFrame() }
|
||||
val restoredStackTraceElements = if (index >= 0)
|
||||
frames.take(index)
|
||||
else
|
||||
frames
|
||||
|
||||
var observedFrame = lastObservedFrame
|
||||
val restoredStackFrames = restoredStackTraceElements.map {
|
||||
val variables: List<XNamedValue> = observedFrame?.let {
|
||||
val spilledVariables = debugMetadata?.baseContinuationImpl?.mirror(it, executionContext)
|
||||
if (spilledVariables != null) {
|
||||
observedFrame = spilledVariables.nextContinuation
|
||||
spilledVariables.spilledValues(executionContext)
|
||||
} else
|
||||
null
|
||||
} ?: emptyList()
|
||||
SuspendCoroutineStackFrameItem(it, locationCache.createLocation(it), variables)
|
||||
}
|
||||
val creationStackFrames = frames.subList(index + 1, frames.size).mapIndexed { ix, it ->
|
||||
|
||||
+1
-1
@@ -141,7 +141,7 @@ class CoroutineInfo private constructor(
|
||||
debugProbesImplMirror.enhanceStackTraceWithThreadDump(context, value, lastObservedStackTrace)
|
||||
else emptyList()
|
||||
val lastObservedThread = threadValue(value, lastObservedThreadField)
|
||||
val lastObservedFrame = threadValue(value, lastObservedFrameField)
|
||||
val lastObservedFrame = objectValue(value, lastObservedFrameField)
|
||||
return MirrorOfCoroutineInfo(
|
||||
value,
|
||||
coroutineContext,
|
||||
|
||||
Reference in New Issue
Block a user