Debugger: Minor, check evaluator preconditions as in Java evaluator

This commit is contained in:
Yan Zhulanow
2019-07-11 21:18:22 +09:00
parent d6487e89ad
commit eb173893b0
2 changed files with 7 additions and 1 deletions
@@ -128,9 +128,14 @@ class KotlinEvaluator(val codeFragment: KtCodeFragment, val sourcePosition: Sour
} }
} }
if (!context.debugProcess.isAttached) {
status.error(EvaluationError.DebuggerNotAttached)
throw EvaluateExceptionUtil.PROCESS_EXITED
}
val frameProxy = context.frameProxy ?: run { val frameProxy = context.frameProxy ?: run {
status.error(EvaluationError.NoFrameProxy) status.error(EvaluationError.NoFrameProxy)
evaluationException("Cannot evaluate a code fragment: frame proxy is not available") throw EvaluateExceptionUtil.NULL_STACK_FRAME
} }
val operatingThread = context.suspendContext.thread ?: run { val operatingThread = context.suspendContext.thread ?: run {
@@ -51,6 +51,7 @@ class EvaluationStatus {
} }
enum class EvaluationError { enum class EvaluationError {
DebuggerNotAttached,
NoFrameProxy, NoFrameProxy,
ThreadNotAvailable, ThreadNotAvailable,
ThreadNotSuspended, ThreadNotSuspended,