Debugger: Unwrap EvaluateExceptions on checking (EA-105847)
This commit is contained in:
+15
-8
@@ -39,18 +39,25 @@ class KotlinCoroutinesAsyncStackTraceProvider : KotlinCoroutinesAsyncStackTraceP
|
|||||||
override fun getAsyncStackTrace(stackFrame: JavaStackFrame, suspendContext: SuspendContextImpl): List<StackFrameItem>? {
|
override fun getAsyncStackTrace(stackFrame: JavaStackFrame, suspendContext: SuspendContextImpl): List<StackFrameItem>? {
|
||||||
return try {
|
return try {
|
||||||
getAsyncStackTraceSafe(stackFrame.stackFrameProxy, suspendContext)
|
getAsyncStackTraceSafe(stackFrame.stackFrameProxy, suspendContext)
|
||||||
} catch (e: ObjectCollectedException) {
|
} catch (e: Exception) {
|
||||||
null
|
handleException(e)
|
||||||
} catch (e: IncompatibleThreadStateException) {
|
|
||||||
null
|
|
||||||
} catch (e: VMDisconnectedException) {
|
|
||||||
null
|
|
||||||
} catch (e: EvaluateException) {
|
|
||||||
LOG.debug("Cannot evaluate async stack trace", e)
|
|
||||||
null
|
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<StackFrameItem>? {
|
fun getAsyncStackTraceSafe(frameProxy: StackFrameProxyImpl, suspendContext: SuspendContextImpl): List<StackFrameItem>? {
|
||||||
val location = frameProxy.location()
|
val location = frameProxy.location()
|
||||||
if (!location.isInKotlinSources()) {
|
if (!location.isInKotlinSources()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user