(CoroutineDebugger) SkipCoroutineStackFrameProxy logic added
This commit is contained in:
-2
@@ -27,8 +27,6 @@ class CoroutineStackFrameInterceptor(val project: Project) : StackFrameIntercept
|
|||||||
isInUnitTest() -> debugProcess.suspendManager.pausedContext
|
isInUnitTest() -> debugProcess.suspendManager.pausedContext
|
||||||
else -> debugProcess.debuggerContext.suspendContext
|
else -> debugProcess.debuggerContext.suspendContext
|
||||||
}
|
}
|
||||||
if (!isInUnitTest())
|
|
||||||
assert(debugProcess.suspendManager.pausedContext === debugProcess.debuggerContext.suspendContext)
|
|
||||||
suspendContextImpl?.let {
|
suspendContextImpl?.let {
|
||||||
CoroutineFrameBuilder.coroutineExitFrame(frame, it)
|
CoroutineFrameBuilder.coroutineExitFrame(frame, it)
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -13,6 +13,7 @@ import com.intellij.debugger.ui.impl.watch.StackFrameDescriptorImpl
|
|||||||
import com.sun.jdi.ObjectReference
|
import com.sun.jdi.ObjectReference
|
||||||
import org.jetbrains.kotlin.idea.debugger.coroutine.data.*
|
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.ContinuationHolder
|
||||||
|
import org.jetbrains.kotlin.idea.debugger.coroutine.proxy.SkipCoroutineStackFrameProxyImpl
|
||||||
import java.lang.Integer.min
|
import java.lang.Integer.min
|
||||||
|
|
||||||
|
|
||||||
@@ -82,7 +83,7 @@ class CoroutineFrameBuilder {
|
|||||||
): RunningCoroutineStackFrameItem? {
|
): RunningCoroutineStackFrameItem? {
|
||||||
val location = frame.location()
|
val location = frame.location()
|
||||||
return if (!location.safeCoroutineExitPointLineNumber())
|
return if (!location.safeCoroutineExitPointLineNumber())
|
||||||
RunningCoroutineStackFrameItem(frame, location)
|
RunningCoroutineStackFrameItem(SkipCoroutineStackFrameProxyImpl(frame), location)
|
||||||
else
|
else
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-9
@@ -58,11 +58,7 @@ class XDebuggerTreeSelectedNodeListener(val session: XDebugSession, val tree: XD
|
|||||||
is RunningCoroutineStackFrameItem -> {
|
is RunningCoroutineStackFrameItem -> {
|
||||||
val threadProxy = stackFrameItem.frame.threadProxy()
|
val threadProxy = stackFrameItem.frame.threadProxy()
|
||||||
val isCurrentContext = suspendContext.thread == threadProxy
|
val isCurrentContext = suspendContext.thread == threadProxy
|
||||||
val executionStack = suspendContext.invokeInManagerThread { JavaExecutionStack(
|
createStackAndSetFrame(threadProxy, { it.createStackFrame(stackFrameItem.frame) }, isCurrentContext)
|
||||||
threadProxy,
|
|
||||||
debugProcess,
|
|
||||||
isCurrentContext) } ?: return false
|
|
||||||
createStackAndSetFrame(threadProxy, { executionStack.createStackFrame(stackFrameItem.frame) }, isCurrentContext)
|
|
||||||
}
|
}
|
||||||
is CreationCoroutineStackFrameItem -> {
|
is CreationCoroutineStackFrameItem -> {
|
||||||
val position = stackFrameItem.stackTraceElement.findPosition(session.project) ?: return false
|
val position = stackFrameItem.stackTraceElement.findPosition(session.project) ?: return false
|
||||||
@@ -114,12 +110,13 @@ class XDebuggerTreeSelectedNodeListener(val session: XDebugSession, val tree: XD
|
|||||||
|
|
||||||
fun createStackAndSetFrame(
|
fun createStackAndSetFrame(
|
||||||
threadReferenceProxy: ThreadReferenceProxyImpl,
|
threadReferenceProxy: ThreadReferenceProxyImpl,
|
||||||
stackFrameProvider: () -> XStackFrame?,
|
stackFrameProvider: (executionStack: JavaExecutionStack) -> XStackFrame?,
|
||||||
isCurrentContext: Boolean = false
|
isCurrentContext: Boolean = false
|
||||||
) {
|
) {
|
||||||
val stackFrameStack = debugProcess.invokeInManagerThread {
|
val stackFrameStack = debugProcess.invokeInManagerThread {
|
||||||
val stackFrame = stackFrameProvider.invoke() ?: return@invokeInManagerThread null
|
val executionStack = createExecutionStack(threadReferenceProxy, isCurrentContext);
|
||||||
XStackFrameStack(stackFrame, createExecutionStack(threadReferenceProxy, isCurrentContext))
|
val stackFrame = stackFrameProvider.invoke(executionStack) ?: return@invokeInManagerThread null
|
||||||
|
XStackFrameStack(stackFrame, executionStack)
|
||||||
} ?: return
|
} ?: return
|
||||||
setCurrentStackFrame(stackFrameStack)
|
setCurrentStackFrame(stackFrameStack)
|
||||||
}
|
}
|
||||||
@@ -134,7 +131,7 @@ class XDebuggerTreeSelectedNodeListener(val session: XDebugSession, val tree: XD
|
|||||||
|
|
||||||
data class XStackFrameStack(val stackFrame: XStackFrame, val executionStack: XExecutionStack)
|
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)
|
val executionStack = JavaExecutionStack(proxy, debugProcess, isCurrentContext)
|
||||||
executionStack.initTopFrame()
|
executionStack.initTopFrame()
|
||||||
return executionStack
|
return executionStack
|
||||||
|
|||||||
Reference in New Issue
Block a user