Debugger: Recognize exceptions from target VM in FUS

This commit is contained in:
Yan Zhulanow
2019-07-24 18:44:51 +09:00
parent 71e8cddaa6
commit 0f568a395f
4 changed files with 12 additions and 9 deletions
@@ -47,7 +47,7 @@ import org.jetbrains.kotlin.idea.KotlinLanguage
import org.jetbrains.kotlin.idea.core.util.attachmentByPsiFile import org.jetbrains.kotlin.idea.core.util.attachmentByPsiFile
import org.jetbrains.kotlin.idea.core.util.mergeAttachments import org.jetbrains.kotlin.idea.core.util.mergeAttachments
import org.jetbrains.kotlin.idea.core.util.runInReadActionWithWriteActionPriorityWithPCE import org.jetbrains.kotlin.idea.core.util.runInReadActionWithWriteActionPriorityWithPCE
import org.jetbrains.kotlin.idea.debugger.DebuggerUtils import org.jetbrains.kotlin.idea.debugger.*
import org.jetbrains.kotlin.idea.debugger.evaluate.KotlinDebuggerCaches.Companion.compileCodeFragmentCacheAware import org.jetbrains.kotlin.idea.debugger.evaluate.KotlinDebuggerCaches.Companion.compileCodeFragmentCacheAware
import org.jetbrains.kotlin.idea.debugger.evaluate.classLoading.GENERATED_CLASS_NAME import org.jetbrains.kotlin.idea.debugger.evaluate.classLoading.GENERATED_CLASS_NAME
import org.jetbrains.kotlin.idea.debugger.evaluate.classLoading.GENERATED_FUNCTION_NAME import org.jetbrains.kotlin.idea.debugger.evaluate.classLoading.GENERATED_FUNCTION_NAME
@@ -55,9 +55,6 @@ import org.jetbrains.kotlin.idea.debugger.evaluate.compilation.*
import org.jetbrains.kotlin.idea.debugger.evaluate.compilingEvaluator.loadClassesSafely import org.jetbrains.kotlin.idea.debugger.evaluate.compilingEvaluator.loadClassesSafely
import org.jetbrains.kotlin.idea.debugger.evaluate.variables.EvaluatorValueConverter import org.jetbrains.kotlin.idea.debugger.evaluate.variables.EvaluatorValueConverter
import org.jetbrains.kotlin.idea.debugger.evaluate.variables.VariableFinder import org.jetbrains.kotlin.idea.debugger.evaluate.variables.VariableFinder
import org.jetbrains.kotlin.idea.debugger.safeLocation
import org.jetbrains.kotlin.idea.debugger.safeMethod
import org.jetbrains.kotlin.idea.debugger.safeVisibleVariableByName
import org.jetbrains.kotlin.idea.util.application.executeWriteCommand import org.jetbrains.kotlin.idea.util.application.executeWriteCommand
import org.jetbrains.kotlin.idea.util.application.runReadAction import org.jetbrains.kotlin.idea.util.application.runReadAction
import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.psi.*
@@ -153,7 +150,13 @@ class KotlinEvaluator(val codeFragment: KtCodeFragment, private val sourcePositi
val executionContext = ExecutionContext(context, frameProxy) val executionContext = ExecutionContext(context, frameProxy)
return evaluateSafe(executionContext, status) return evaluateSafe(executionContext, status)
} catch (e: EvaluateException) { } catch (e: EvaluateException) {
status.error(EvaluationError.EvaluateException) val error = if (e.exceptionFromTargetVM != null) {
EvaluationError.ExceptionFromEvaluatedCode
} else {
EvaluationError.EvaluateException
}
status.error(error)
throw e throw e
} catch (e: ProcessCanceledException) { } catch (e: ProcessCanceledException) {
status.error(EvaluationError.ProcessCancelledException) status.error(EvaluationError.ProcessCancelledException)
@@ -431,7 +434,7 @@ class KotlinEvaluator(val codeFragment: KtCodeFragment, private val sourcePositi
is ExceptionThrown -> { is ExceptionThrown -> {
when { when {
this.kind == ExceptionThrown.ExceptionKind.FROM_EVALUATED_CODE -> { this.kind == ExceptionThrown.ExceptionKind.FROM_EVALUATED_CODE -> {
status.error(EvaluationError.Eval4JExceptionFromEvaluatedCode) status.error(EvaluationError.ExceptionFromEvaluatedCode)
evaluationException(InvocationException(this.exception.value as ObjectReference)) evaluationException(InvocationException(this.exception.value as ObjectReference))
} }
this.kind == ExceptionThrown.ExceptionKind.BROKEN_CODE -> this.kind == ExceptionThrown.ExceptionKind.BROKEN_CODE ->
@@ -71,10 +71,10 @@ enum class EvaluationError {
SuspendCall, SuspendCall,
CrossInlineLambda, CrossInlineLambda,
Eval4JExceptionFromEvaluatedCode,
Eval4JAbnormalTermination, Eval4JAbnormalTermination,
Eval4JUnknownException, Eval4JUnknownException,
ExceptionFromEvaluatedCode,
ErrorElementOccurred, ErrorElementOccurred,
FrontendException, FrontendException,
BackendException, BackendException,
+1 -1
View File
@@ -77,7 +77,7 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio.
<statistics.counterUsagesCollector groupId="kotlin.ide.action.refactoring" version="1"/> <statistics.counterUsagesCollector groupId="kotlin.ide.action.refactoring" version="1"/>
<statistics.counterUsagesCollector groupId="kotlin.ide.newFileTempl" version="1"/> <statistics.counterUsagesCollector groupId="kotlin.ide.newFileTempl" version="1"/>
<statistics.counterUsagesCollector groupId="kotlin.ide.npwizards" version="1"/> <statistics.counterUsagesCollector groupId="kotlin.ide.npwizards" version="1"/>
<statistics.counterUsagesCollector groupId="kotlin.ide.debugger.eval" version="1"/> <statistics.counterUsagesCollector groupId="kotlin.ide.debugger.eval" version="2"/>
<statistics.counterUsagesCollector groupId="kotlin.ide.j2k" version="1"/> <statistics.counterUsagesCollector groupId="kotlin.ide.j2k" version="1"/>
<statistics.projectUsagesCollector implementation="org.jetbrains.kotlin.idea.statistics.IDESettingsFUSCollector"/> <statistics.projectUsagesCollector implementation="org.jetbrains.kotlin.idea.statistics.IDESettingsFUSCollector"/>
+1 -1
View File
@@ -77,7 +77,7 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio.
<statistics.counterUsagesCollector groupId="kotlin.ide.action.refactoring" version="1"/> <statistics.counterUsagesCollector groupId="kotlin.ide.action.refactoring" version="1"/>
<statistics.counterUsagesCollector groupId="kotlin.ide.newFileTempl" version="1"/> <statistics.counterUsagesCollector groupId="kotlin.ide.newFileTempl" version="1"/>
<statistics.counterUsagesCollector groupId="kotlin.ide.npwizards" version="1"/> <statistics.counterUsagesCollector groupId="kotlin.ide.npwizards" version="1"/>
<statistics.counterUsagesCollector groupId="kotlin.ide.debugger.eval" version="1"/> <statistics.counterUsagesCollector groupId="kotlin.ide.debugger.eval" version="2"/>
<statistics.counterUsagesCollector groupId="kotlin.ide.j2k" version="1"/> <statistics.counterUsagesCollector groupId="kotlin.ide.j2k" version="1"/>
<statistics.projectUsagesCollector implementation="org.jetbrains.kotlin.idea.statistics.IDESettingsFUSCollector"/> <statistics.projectUsagesCollector implementation="org.jetbrains.kotlin.idea.statistics.IDESettingsFUSCollector"/>