From a664df814321c9ddc1fe73366bb7a8fe3d59236f Mon Sep 17 00:00:00 2001 From: Yan Zhulanow Date: Tue, 23 Jul 2019 21:19:52 +0900 Subject: [PATCH] Debugger: Unwrap EvaluateExceptions on checking (EA-105847) --- ...KotlinCoroutinesAsyncStackTraceProvider.kt | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/KotlinCoroutinesAsyncStackTraceProvider.kt b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/KotlinCoroutinesAsyncStackTraceProvider.kt index f7cdd2e178f..343dfd3d0bb 100644 --- a/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/KotlinCoroutinesAsyncStackTraceProvider.kt +++ b/idea/jvm-debugger/jvm-debugger-core/src/org/jetbrains/kotlin/idea/debugger/KotlinCoroutinesAsyncStackTraceProvider.kt @@ -39,18 +39,25 @@ class KotlinCoroutinesAsyncStackTraceProvider : KotlinCoroutinesAsyncStackTraceP override fun getAsyncStackTrace(stackFrame: JavaStackFrame, suspendContext: SuspendContextImpl): List? { return try { getAsyncStackTraceSafe(stackFrame.stackFrameProxy, suspendContext) - } catch (e: ObjectCollectedException) { - null - } catch (e: IncompatibleThreadStateException) { - null - } catch (e: VMDisconnectedException) { - null - } catch (e: EvaluateException) { - LOG.debug("Cannot evaluate async stack trace", e) + } catch (e: Exception) { + handleException(e) null } } + private fun handleException(e: Exception) { + when (if (e is EvaluateException) e.cause ?: e else e) { + is ObjectCollectedException, is IncompatibleThreadStateException, is VMDisconnectedException -> {} + else -> { + if (e is EvaluateException) { + LOG.debug("Cannot evaluate async stack trace", e) + } else { + throw e + } + } + } + } + fun getAsyncStackTraceSafe(frameProxy: StackFrameProxyImpl, suspendContext: SuspendContextImpl): List? { val location = frameProxy.location() if (!location.isInKotlinSources()) {