File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
adapter/src/main/kotlin/org/javacs/ktda/jdi/stack Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change 1
1
package org.javacs.ktda.jdi.stack
2
2
3
+ import org.javacs.kt.LOG
3
4
import org.javacs.ktda.core.Position
4
5
import org.javacs.ktda.core.completion.CompletionItem
5
6
import org.javacs.ktda.core.completion.CompletionItemType
6
7
import org.javacs.ktda.core.scope.VariableTreeNode
7
8
import org.javacs.ktda.core.stack.StackFrame
8
9
import org.javacs.ktda.jdi.JDISessionContext
9
10
import org.javacs.ktda.jdi.scope.JDILocalScope
11
+ import com.sun.jdi.InvalidStackFrameException
10
12
11
13
class JDIStackFrame (
12
14
frame : com.sun.jdi.StackFrame ,
@@ -15,9 +17,14 @@ class JDIStackFrame(
15
17
private val location = frame.location()
16
18
override val name: String = location.method()?.name() ? : " Unknown"
17
19
override val position: Position ? = context.positionOf(location)
18
- override val scopes: List <VariableTreeNode > by lazy { listOf (
19
- JDILocalScope (frame)
20
- ) }
20
+ override val scopes: List <VariableTreeNode > by lazy {
21
+ try {
22
+ listOf (JDILocalScope (frame))
23
+ } catch (e: InvalidStackFrameException ) {
24
+ LOG .warn(" Could not fetch scopes, invalid stack frame: {}" , e.message)
25
+ emptyList<VariableTreeNode >()
26
+ }
27
+ }
21
28
22
29
private val variables by lazy { scopes.flatMap { it.childs ? : emptyList() } }
23
30
You can’t perform that action at this time.
0 commit comments