(CoroutineDebugger) unused classes removed / code cleanup

This commit is contained in:
Vladimir Ilmov
2020-04-18 23:27:17 +02:00
parent 3cd0eb0fca
commit 677ca2b9ae
5 changed files with 2 additions and 36 deletions
@@ -83,20 +83,6 @@ class DefaultCoroutineStackFrameItem(location: Location, spilledVariables: List<
* - Kotlin/JavaStackFrame -> PreCoroutineStackFrameItem : CoroutinePreflightStackFrame.threadPreCoroutineFrames * - Kotlin/JavaStackFrame -> PreCoroutineStackFrameItem : CoroutinePreflightStackFrame.threadPreCoroutineFrames
* *
*/ */
class PreCoroutineStackFrameItem internal constructor(val frame: StackFrameProxyImpl, location: Location, variables: List<XNamedValue> = emptyList()) :
CoroutineStackFrameItem(location, variables) {
constructor(frame: StackFrameProxyImpl, variables: List<XNamedValue> = emptyList()) : this(frame, frame.location(), variables)
constructor(frame: StackFrameProxyImpl, restoredCoroutineStackFrameItem: CoroutineStackFrameItem) : this(
frame,
restoredCoroutineStackFrameItem.location,
restoredCoroutineStackFrameItem.spilledVariables
)
override fun createFrame(debugProcess: DebugProcessImpl): CapturedStackFrame {
return PreCoroutineStackFrame(frame, debugProcess, this)
}
}
class RunningCoroutineStackFrameItem( class RunningCoroutineStackFrameItem(
val frame: StackFrameProxyImpl, val frame: StackFrameProxyImpl,
@@ -79,21 +79,6 @@ class CreationCoroutineStackFrame(debugProcess: DebugProcessImpl, item: StackFra
true true
} }
/**
* Acts as a joint frame, take variables from restored frame and information from the real 'exit' frame.
*/
class PreCoroutineStackFrame(val frame: StackFrameProxyImpl, val debugProcess: DebugProcessImpl, item: StackFrameItem) :
CoroutineStackFrame(debugProcess, item) {
override fun computeChildren(node: XCompositeNode) {
val fakeStackFrame = debugProcess.invokeInManagerThread {
val skipCoroutineFrame = SkipCoroutineStackFrameProxyImpl(frame)
debugProcess.positionManager.createStackFrame(skipCoroutineFrame, debugProcess, frame.location())
}
fakeStackFrame?.computeChildren(node)
// super.computeChildren(node)
}
}
open class CoroutineStackFrame(debugProcess: DebugProcessImpl, val item: StackFrameItem, val realStackFrame: XStackFrame? = null) : open class CoroutineStackFrame(debugProcess: DebugProcessImpl, val item: StackFrameItem, val realStackFrame: XStackFrame? = null) :
StackFrameItem.CapturedStackFrame(debugProcess, item) { StackFrameItem.CapturedStackFrame(debugProcess, item) {
override fun customizePresentation(component: ColoredTextContainer) { override fun customizePresentation(component: ColoredTextContainer) {
@@ -17,7 +17,7 @@ class DebugMetadata internal constructor(context: DefaultExecutionContext) :
private val getStackTraceElementMethod = makeMethod("getStackTraceElement") private val getStackTraceElementMethod = makeMethod("getStackTraceElement")
private val getSpilledVariableFieldMappingMethod = private val getSpilledVariableFieldMappingMethod =
makeMethod("getSpilledVariableFieldMapping", "(Lkotlin/coroutines/jvm/internal/BaseContinuationImpl;)[Ljava/lang/String;") makeMethod("getSpilledVariableFieldMapping", "(Lkotlin/coroutines/jvm/internal/BaseContinuationImpl;)[Ljava/lang/String;")
val baseContinuationImpl = BaseContinuationImpl(context, this); val baseContinuationImpl = BaseContinuationImpl(context, this)
override fun fetchMirror(value: ObjectReference, context: DefaultExecutionContext): MirrorOfDebugProbesImpl? { override fun fetchMirror(value: ObjectReference, context: DefaultExecutionContext): MirrorOfDebugProbesImpl? {
// @TODO fix this // @TODO fix this
@@ -60,10 +60,7 @@ class CoroutineFrameBuilder {
// rest of the stack // rest of the stack
stackFrames.addAll(preflightFrame.threadPreCoroutineFrames.drop(1).mapIndexedNotNull { index, stackFrameProxyImpl -> stackFrames.addAll(preflightFrame.threadPreCoroutineFrames.drop(1).mapIndexedNotNull { index, stackFrameProxyImpl ->
// if (index == 0) suspendContext.invokeInManagerThread { buildRealStackFrameItem(stackFrameProxyImpl) }
// PreCoroutineStackFrameItem(stackFrameProxyImpl, firstRestoredFrame) // get location and variables from restored part
// else
suspendContext.invokeInManagerThread { buildRealStackFrameItem(stackFrameProxyImpl) }
}) })
return DoubleFrameList(stackFrames, preflightFrame.coroutineInfoData.creationStackTrace) return DoubleFrameList(stackFrames, preflightFrame.coroutineInfoData.creationStackTrace)
@@ -81,7 +78,6 @@ class CoroutineFrameBuilder {
return RunningCoroutineStackFrameItem(frame, location) return RunningCoroutineStackFrameItem(frame, location)
} }
/** /**
* Used by CoroutineStackFrameInterceptor to check if that frame is 'exit' coroutine frame. * Used by CoroutineStackFrameInterceptor to check if that frame is 'exit' coroutine frame.
*/ */
@@ -1,5 +1,4 @@
package continuation package continuation
// ATTACH_LIBRARY: coroutines
// ATTACH_LIBRARY: maven(org.jetbrains.kotlinx:kotlinx-coroutines-debug:1.3.4)-javaagent // ATTACH_LIBRARY: maven(org.jetbrains.kotlinx:kotlinx-coroutines-debug:1.3.4)-javaagent
import kotlinx.coroutines.runBlocking import kotlinx.coroutines.runBlocking