[coroutine][debugger] refactoring being done
X-view approach added for review, thread groups added
This commit is contained in:
committed by
Vladimir Ilmov
parent
7f0437da68
commit
61c5ef61cc
+3
-3
@@ -10,7 +10,7 @@ import com.intellij.debugger.engine.JavaValue
|
||||
import com.intellij.debugger.memory.utils.StackFrameItem
|
||||
import com.intellij.execution.process.ProcessOutputTypes
|
||||
import com.intellij.openapi.extensions.Extensions
|
||||
import org.jetbrains.kotlin.idea.debugger.KotlinCoroutinesAsyncStackTraceProvider
|
||||
import org.jetbrains.kotlin.idea.debugger.coroutines.CoroutineAsyncStackTraceProvider
|
||||
import org.jetbrains.kotlin.idea.debugger.test.preference.DebuggerPreferences
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull
|
||||
import org.jetbrains.kotlin.utils.getSafe
|
||||
@@ -54,7 +54,7 @@ abstract class AbstractAsyncStackTraceTest : KotlinDescriptorTestCaseWithSteppin
|
||||
}
|
||||
}
|
||||
|
||||
private fun getAsyncStackTraceProvider(): KotlinCoroutinesAsyncStackTraceProvider? {
|
||||
private fun getAsyncStackTraceProvider(): CoroutineAsyncStackTraceProvider? {
|
||||
val area = Extensions.getArea(null)
|
||||
if (!area.hasExtensionPoint(ASYNC_STACKTRACE_EP_NAME)) {
|
||||
System.err.println("$ASYNC_STACKTRACE_EP_NAME extension point is not found (probably old IDE version)")
|
||||
@@ -62,7 +62,7 @@ abstract class AbstractAsyncStackTraceTest : KotlinDescriptorTestCaseWithSteppin
|
||||
}
|
||||
|
||||
val extensionPoint = area.getExtensionPoint<Any>(ASYNC_STACKTRACE_EP_NAME)
|
||||
val provider = extensionPoint.extensions.firstIsInstanceOrNull<KotlinCoroutinesAsyncStackTraceProvider>()
|
||||
val provider = extensionPoint.extensions.firstIsInstanceOrNull<CoroutineAsyncStackTraceProvider>()
|
||||
|
||||
if (provider == null) {
|
||||
System.err.println("Kotlin coroutine async stack trace provider is not found")
|
||||
|
||||
+12
-18
@@ -5,59 +5,53 @@
|
||||
|
||||
package org.jetbrains.kotlin.idea.debugger.test
|
||||
|
||||
import com.intellij.debugger.engine.evaluation.EvaluationContextImpl
|
||||
import com.intellij.execution.configurations.JavaParameters
|
||||
import com.intellij.execution.process.ProcessOutputTypes
|
||||
import com.intellij.jarRepository.JarRepositoryManager
|
||||
import com.intellij.jarRepository.RemoteRepositoryDescription
|
||||
import org.jetbrains.idea.maven.aether.ArtifactKind
|
||||
import org.jetbrains.jps.model.library.JpsMavenRepositoryLibraryDescriptor
|
||||
import org.jetbrains.kotlin.idea.debugger.coroutines.CoroutineState
|
||||
import org.jetbrains.kotlin.idea.debugger.coroutines.CoroutinesDebugProbesProxy
|
||||
import org.jetbrains.kotlin.idea.debugger.evaluate.ExecutionContext
|
||||
import org.jetbrains.kotlin.idea.debugger.coroutines.data.CoroutineInfoData
|
||||
import org.jetbrains.kotlin.idea.debugger.coroutines.proxy.CoroutinesDebugProbesProxy
|
||||
import org.jetbrains.kotlin.idea.debugger.test.preference.DebuggerPreferences
|
||||
|
||||
abstract class AbstractCoroutineDumpTest : KotlinDescriptorTestCaseWithStepping() {
|
||||
override fun doMultiFileTest(files: TestFiles, preferences: DebuggerPreferences) {
|
||||
doOnBreakpoint {
|
||||
val evalContext = EvaluationContextImpl(this, frameProxy)
|
||||
val execContext = ExecutionContext(evalContext, frameProxy ?: return@doOnBreakpoint)
|
||||
val either = CoroutinesDebugProbesProxy.dumpCoroutines(execContext)
|
||||
val infoCache = CoroutinesDebugProbesProxy(this).dumpCoroutines()
|
||||
try {
|
||||
if (either.isRight)
|
||||
if (infoCache.isOk())
|
||||
try {
|
||||
val states = either.get()
|
||||
val states = infoCache.cache
|
||||
print(stringDump(states), ProcessOutputTypes.SYSTEM)
|
||||
} catch (ignored: Throwable) {
|
||||
}
|
||||
else
|
||||
throw AssertionError("Dump failed", either.left)
|
||||
throw AssertionError("Dump failed")
|
||||
} finally {
|
||||
resume(this)
|
||||
}
|
||||
}
|
||||
|
||||
doOnBreakpoint {
|
||||
val evalContext = EvaluationContextImpl(this, frameProxy)
|
||||
val execContext = ExecutionContext(evalContext, frameProxy ?: return@doOnBreakpoint)
|
||||
val either = CoroutinesDebugProbesProxy.dumpCoroutines(execContext)
|
||||
val infoCache = CoroutinesDebugProbesProxy(this).dumpCoroutines()
|
||||
try {
|
||||
if (either.isRight)
|
||||
if (infoCache.isOk())
|
||||
try {
|
||||
val states = either.get()
|
||||
val states = infoCache.cache
|
||||
print(stringDump(states), ProcessOutputTypes.SYSTEM)
|
||||
} catch (ignored: Throwable) {
|
||||
}
|
||||
else
|
||||
throw AssertionError("Dump failed", either.left)
|
||||
throw AssertionError("Dump failed")
|
||||
} finally {
|
||||
resume(this)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun stringDump(states: List<CoroutineState>) = buildString {
|
||||
states.forEach {
|
||||
private fun stringDump(infoData: List<CoroutineInfoData>) = buildString {
|
||||
infoData.forEach {
|
||||
appendln("\"${it.name}\", state: ${it.state}")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user