(CoroutineDebugger) SkipCoroutineStackFrameProxy logic added

This commit is contained in:
Vladimir Ilmov
2020-04-24 14:58:40 +02:00
parent 887165a23b
commit 38622d8d92
3 changed files with 8 additions and 12 deletions
@@ -27,8 +27,6 @@ class CoroutineStackFrameInterceptor(val project: Project) : StackFrameIntercept
isInUnitTest() -> debugProcess.suspendManager.pausedContext
else -> debugProcess.debuggerContext.suspendContext
}
if (!isInUnitTest())
assert(debugProcess.suspendManager.pausedContext === debugProcess.debuggerContext.suspendContext)
suspendContextImpl?.let {
CoroutineFrameBuilder.coroutineExitFrame(frame, it)
}
@@ -13,6 +13,7 @@ import com.intellij.debugger.ui.impl.watch.StackFrameDescriptorImpl
import com.sun.jdi.ObjectReference
import org.jetbrains.kotlin.idea.debugger.coroutine.data.*
import org.jetbrains.kotlin.idea.debugger.coroutine.proxy.ContinuationHolder
import org.jetbrains.kotlin.idea.debugger.coroutine.proxy.SkipCoroutineStackFrameProxyImpl
import java.lang.Integer.min
@@ -82,7 +83,7 @@ class CoroutineFrameBuilder {
): RunningCoroutineStackFrameItem? {
val location = frame.location()
return if (!location.safeCoroutineExitPointLineNumber())
RunningCoroutineStackFrameItem(frame, location)
RunningCoroutineStackFrameItem(SkipCoroutineStackFrameProxyImpl(frame), location)
else
null
}
@@ -58,11 +58,7 @@ class XDebuggerTreeSelectedNodeListener(val session: XDebugSession, val tree: XD
is RunningCoroutineStackFrameItem -> {
val threadProxy = stackFrameItem.frame.threadProxy()
val isCurrentContext = suspendContext.thread == threadProxy
val executionStack = suspendContext.invokeInManagerThread { JavaExecutionStack(
threadProxy,
debugProcess,
isCurrentContext) } ?: return false
createStackAndSetFrame(threadProxy, { executionStack.createStackFrame(stackFrameItem.frame) }, isCurrentContext)
createStackAndSetFrame(threadProxy, { it.createStackFrame(stackFrameItem.frame) }, isCurrentContext)
}
is CreationCoroutineStackFrameItem -> {
val position = stackFrameItem.stackTraceElement.findPosition(session.project) ?: return false
@@ -114,12 +110,13 @@ class XDebuggerTreeSelectedNodeListener(val session: XDebugSession, val tree: XD
fun createStackAndSetFrame(
threadReferenceProxy: ThreadReferenceProxyImpl,
stackFrameProvider: () -> XStackFrame?,
stackFrameProvider: (executionStack: JavaExecutionStack) -> XStackFrame?,
isCurrentContext: Boolean = false
) {
val stackFrameStack = debugProcess.invokeInManagerThread {
val stackFrame = stackFrameProvider.invoke() ?: return@invokeInManagerThread null
XStackFrameStack(stackFrame, createExecutionStack(threadReferenceProxy, isCurrentContext))
val executionStack = createExecutionStack(threadReferenceProxy, isCurrentContext);
val stackFrame = stackFrameProvider.invoke(executionStack) ?: return@invokeInManagerThread null
XStackFrameStack(stackFrame, executionStack)
} ?: return
setCurrentStackFrame(stackFrameStack)
}
@@ -134,7 +131,7 @@ class XDebuggerTreeSelectedNodeListener(val session: XDebugSession, val tree: XD
data class XStackFrameStack(val stackFrame: XStackFrame, val executionStack: XExecutionStack)
private fun createExecutionStack(proxy: ThreadReferenceProxyImpl, isCurrentContext: Boolean = false): XExecutionStack {
private fun createExecutionStack(proxy: ThreadReferenceProxyImpl, isCurrentContext: Boolean = false): JavaExecutionStack {
val executionStack = JavaExecutionStack(proxy, debugProcess, isCurrentContext)
executionStack.initTopFrame()
return executionStack