[debugger devkit] EA-1491048 Do not evaluate methods after pause

GitOrigin-RevId: 49a6d42e24bc071cb5d0d117695401eb42ee2dfe
This commit is contained in:
Maksim Zuev
2024-10-23 12:51:03 +02:00
committed by intellij-monorepo-bot
parent 044537bda6
commit 519af57785
3 changed files with 25 additions and 4 deletions

View File

@@ -2,6 +2,7 @@
package org.jetbrains.idea.devkit.debugger
import com.intellij.debugger.engine.*
import com.intellij.debugger.engine.evaluation.EvaluateException
import com.intellij.debugger.engine.evaluation.EvaluationContext
import com.intellij.debugger.engine.evaluation.EvaluationContextImpl
import com.intellij.debugger.engine.jdi.StackFrameProxy
@@ -51,7 +52,9 @@ internal fun getIdeState(evaluationContext: EvaluationContext): IdeState? = try
}
}
catch (e: Exception) {
DebuggerUtilsImpl.logError(e)
if (!logIncorrectSuspendState(e)) {
DebuggerUtilsImpl.logError(e)
}
null
}
@@ -62,7 +65,15 @@ internal class DebugeeIdeStateRenderer : ExtraDebugNodesProvider {
val ideState = getIdeState(evaluationContext) ?: return
if (ideState.readAllowed == null && ideState.writeAllowed == null) return
val (isReadActionAllowed, isWriteActionAllowed) = (ideState.readAllowed to ideState.writeAllowed).adjustLockStatus(evaluationContext)
val (isReadActionAllowed, isWriteActionAllowed) = try {
(ideState.readAllowed to ideState.writeAllowed).adjustLockStatus(evaluationContext)
}
catch (e: EvaluateException) {
if (!logIncorrectSuspendState(e)) {
DebuggerUtilsImpl.logError(e)
}
return
}
fun icon(isAvailable: Boolean) = if (isAvailable) "" else ""
children.addTopValue(object : XNamedValue(DevKitDebuggerBundle.message("debugger.ide.state")) {

View File

@@ -79,6 +79,7 @@ private class SessionThreadsData(val disposable: Disposable) {
state.setNonCancellable(suspendContext, true)
}
catch (e: Exception) {
if (logIncorrectSuspendState(e)) return
DebuggerUtilsImpl.logError(e)
}
}
@@ -97,6 +98,7 @@ private class SessionThreadsData(val disposable: Disposable) {
}
}
catch (e: Exception) {
if (logIncorrectSuspendState(e)) return
DebuggerUtilsImpl.logError(e)
}
}

View File

@@ -2,10 +2,10 @@
package org.jetbrains.idea.devkit.debugger
import com.intellij.debugger.engine.DebugProcessImpl
import com.intellij.debugger.engine.SuspendContextImpl
import com.intellij.debugger.engine.evaluation.EvaluateException
import com.intellij.debugger.engine.evaluation.EvaluationContext
import com.intellij.debugger.engine.events.SuspendContextCommandImpl
import com.intellij.openapi.diagnostic.fileLogger
import com.sun.jdi.IncompatibleThreadStateException
import com.sun.jdi.ReferenceType
internal fun findClassOrNull(evaluationContext: EvaluationContext, fqn: String): ReferenceType? {
@@ -17,3 +17,11 @@ internal fun findClassOrNull(evaluationContext: EvaluationContext, fqn: String):
null
}
}
internal fun logIncorrectSuspendState(e: Exception): Boolean {
if (e !is EvaluateException) return false
val cause = e.cause ?: return false
if (cause !is IncompatibleThreadStateException) return false
fileLogger().info(e)
return true
}