(CoroutineDebugger) StackFrameInterceptor service added to KotlinPositionManager, dependency cleanup
This commit is contained in:
+5
-4
@@ -36,7 +36,6 @@ import org.jetbrains.kotlin.codegen.inline.KOTLIN_STRATA_NAME
|
||||
import org.jetbrains.kotlin.fileClasses.JvmFileClassUtil
|
||||
import org.jetbrains.kotlin.idea.core.KotlinFileTypeFactory
|
||||
import org.jetbrains.kotlin.idea.core.util.CodeInsightUtils
|
||||
import org.jetbrains.kotlin.idea.core.util.getLineCount
|
||||
import org.jetbrains.kotlin.idea.core.util.getLineStartOffset
|
||||
import org.jetbrains.kotlin.idea.debugger.breakpoints.getLambdasAtLineIfAny
|
||||
import org.jetbrains.kotlin.idea.debugger.evaluate.KotlinDebuggerCaches
|
||||
@@ -53,6 +52,8 @@ import org.jetbrains.kotlin.resolve.inline.InlineUtil
|
||||
import org.jetbrains.kotlin.resolve.jvm.JvmClassName
|
||||
|
||||
class KotlinPositionManager(private val myDebugProcess: DebugProcess) : MultiRequestPositionManager, PositionManagerEx() {
|
||||
private val stackFrameInterceptor: StackFrameInterceptor = myDebugProcess.project.getService()
|
||||
|
||||
private val allKotlinFilesScope = object : DelegatingGlobalSearchScope(
|
||||
KotlinSourceFilterScope.projectAndLibrariesSources(GlobalSearchScope.allScope(myDebugProcess.project), myDebugProcess.project)
|
||||
) {
|
||||
@@ -80,9 +81,9 @@ class KotlinPositionManager(private val myDebugProcess: DebugProcess) : MultiReq
|
||||
}
|
||||
|
||||
override fun createStackFrame(frame: StackFrameProxyImpl, debugProcess: DebugProcessImpl, location: Location): XStackFrame? =
|
||||
if (location.isInKotlinSources())
|
||||
KotlinStackFrame(frame)
|
||||
else
|
||||
if (location.isInKotlinSources()) {
|
||||
stackFrameInterceptor.createStackFrame(frame, debugProcess, location) ?: KotlinStackFrame(frame)
|
||||
} else
|
||||
null
|
||||
|
||||
override fun getSourcePosition(location: Location?): SourcePosition? {
|
||||
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.idea.debugger;
|
||||
|
||||
import com.intellij.debugger.engine.DebugProcessImpl;
|
||||
import com.intellij.debugger.jdi.StackFrameProxyImpl;
|
||||
import com.intellij.xdebugger.frame.XStackFrame
|
||||
import com.sun.jdi.Location;
|
||||
import org.jetbrains.kotlin.idea.debugger.stackFrame.KotlinStackFrame;
|
||||
|
||||
interface StackFrameInterceptor {
|
||||
fun createStackFrame(
|
||||
frame: StackFrameProxyImpl,
|
||||
debugProcess: DebugProcessImpl,
|
||||
location: Location
|
||||
): XStackFrame?
|
||||
}
|
||||
+3
-1
@@ -24,9 +24,11 @@ import org.jetbrains.kotlin.codegen.inline.isFakeLocalVariableForInline
|
||||
import org.jetbrains.kotlin.idea.debugger.*
|
||||
import org.jetbrains.kotlin.idea.debugger.evaluate.KotlinDebuggerEvaluator
|
||||
|
||||
class KotlinStackFrame(frame: StackFrameProxyImpl) : JavaStackFrame(StackFrameDescriptorImpl(frame, MethodsTracker()), true) {
|
||||
open class KotlinStackFrame(stackFrameDescriptorImpl: StackFrameDescriptorImpl) : JavaStackFrame(stackFrameDescriptorImpl, true) {
|
||||
private val kotlinVariableViewService = ToggleKotlinVariablesState.getService()
|
||||
|
||||
constructor(frame: StackFrameProxyImpl) : this(StackFrameDescriptorImpl(frame, MethodsTracker()))
|
||||
|
||||
private val kotlinEvaluator by lazy {
|
||||
val debugProcess = descriptor.debugProcess as DebugProcessImpl // Cast as in JavaStackFrame
|
||||
KotlinDebuggerEvaluator(debugProcess, this@KotlinStackFrame)
|
||||
|
||||
Reference in New Issue
Block a user