Remove isAtBreakpoint checks as it's not valid in all cases
For example, when we stopped at a breakpoint and then did a 'step over' action, we aren't at that breakpoint any more. However, we still can evaluate things.
This commit is contained in:
+4
-2
@@ -43,9 +43,11 @@ class KotlinCoroutinesAsyncStackTraceProvider : KotlinCoroutinesAsyncStackTraceP
|
||||
if (!location.isInKotlinSources()) {
|
||||
return null
|
||||
}
|
||||
|
||||
val method = location.safeMethod() ?: return null
|
||||
val currentThread = frameProxy.threadProxy().threadReference
|
||||
if (currentThread == null || !currentThread.isSuspended || !currentThread.isAtBreakpoint) {
|
||||
val threadReference = frameProxy.threadProxy().threadReference
|
||||
|
||||
if (threadReference == null || !threadReference.isSuspended || !suspendContext.debugProcess.canRunEvaluation) {
|
||||
return null
|
||||
}
|
||||
|
||||
|
||||
@@ -276,3 +276,9 @@ fun Type.isSubtype(type: AsmType): Boolean {
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
val DebuggerContextImpl.canRunEvaluation: Boolean
|
||||
get() = debugProcess?.canRunEvaluation ?: false
|
||||
|
||||
val DebugProcessImpl.canRunEvaluation: Boolean
|
||||
get() = suspendManager.pausedContext != null
|
||||
+1
-1
@@ -315,7 +315,7 @@ class KotlinEvaluator(val codeFragment: KtCodeFragment, val sourcePosition: Sour
|
||||
|
||||
return runEvaluation(context, compiledData, classLoader ?: context.evaluationContext.classLoader) { args ->
|
||||
val vm = context.vm.virtualMachine
|
||||
val thread = context.suspendContext.thread?.threadReference?.takeIf { it.isAtBreakpoint }
|
||||
val thread = context.suspendContext.thread?.threadReference?.takeIf { it.isSuspended }
|
||||
?: error("Can not find a thread to run evaluation on")
|
||||
|
||||
val eval = JDIEval(vm, classLoader, thread, context.invokePolicy)
|
||||
|
||||
+2
-1
@@ -33,6 +33,7 @@ import com.sun.jdi.*
|
||||
import com.sun.jdi.Type
|
||||
import org.jetbrains.kotlin.idea.debugger.KotlinDebuggerSettings
|
||||
import org.jetbrains.kotlin.idea.debugger.ToggleKotlinVariablesState
|
||||
import org.jetbrains.kotlin.idea.debugger.canRunEvaluation
|
||||
import org.jetbrains.kotlin.load.java.JvmAbi
|
||||
import java.util.*
|
||||
import com.sun.jdi.Type as JdiType
|
||||
@@ -80,7 +81,7 @@ class KotlinClassWithDelegatedPropertyRenderer(private val rendererSettings: Nod
|
||||
listener: DescriptorLabelListener
|
||||
): String? {
|
||||
val toStringRenderer = rendererSettings.toStringRenderer
|
||||
if (toStringRenderer.isEnabled && DebuggerManagerEx.getInstanceEx(evaluationContext.project).context.isEvaluationPossible) {
|
||||
if (toStringRenderer.isEnabled && DebuggerManagerEx.getInstanceEx(evaluationContext.project).context.canRunEvaluation) {
|
||||
if (toStringRenderer.isApplicable(descriptor.type)) {
|
||||
return toStringRenderer.calcLabel(descriptor, evaluationContext, listener)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user