Debugger: Prefer the closest captured values

This commit is contained in:
Yan Zhulanow
2019-06-14 17:10:09 +09:00
parent 4fe6431b0f
commit c2f0286183
8 changed files with 243 additions and 146 deletions
@@ -3,14 +3,14 @@ Run Java
Connected to the target VM
capturedValues1.kt:17
frame = invoke:17, CapturedValues1Kt$foo$1$1$1 {capturedValues1}
unknown = this (@foo) = 1000
unknown = args = {java.lang.String[0]@uniqueID}
unknown = b = 2
unknown = this (@place1) = x
field = value: char[] = {char[1]@uniqueID} (sp = String.!EXT!)
element = 0 = 'x' 120
field = hash: int = 0 (sp = String.!EXT!)
unknown = c2 = 3
unknown = b = 2
unknown = this (@foo) = 1000
unknown = args = {java.lang.String[0]@uniqueID}
local = this: java.lang.String = y (sp = null)
field = value: char[] = {char[1]@uniqueID} (sp = String.!EXT!)
element = 0 = 'y' 121
@@ -1,27 +1,29 @@
package capturedValues2
fun main() {
1000.foo()
}
val a = 1
fun Int.foo() {
block {
val b = 1
val b2 = 2
block("x") foo@ {
//Breakpoint!
this@foo + b
foo(a)
val a = 2
block {
foo(a)
val a = 3
block {
//Breakpoint!
foo(a)
}
}
}
}
fun block(block: () -> Unit) {
inline fun block(block: () -> Unit) {
block()
}
fun <T> block(obj: T, block: T.() -> Unit) {
obj.block()
}
fun foo(foo: Int) {}
// SHOW_KOTLIN_VARIABLES
// PRINT_FRAME
@@ -1,13 +1,9 @@
LineBreakpoint created at capturedValues2.kt:13
LineBreakpoint created at capturedValues2.kt:16
Run Java
Connected to the target VM
capturedValues2.kt:13
frame = invoke:13, CapturedValues2Kt$foo$1$1 {capturedValues2}
unknown = b = 1
local = this: java.lang.String = x (sp = null)
field = value: char[] = {char[1]@uniqueID} (sp = String.!EXT!)
element = 0 = 'x' 120
field = hash: int = 0 (sp = String.!EXT!)
capturedValues2.kt:16
frame = main:16, CapturedValues2Kt {capturedValues2}
local = a: int = 3 (sp = capturedValues2.kt, 13)
Disconnected from the target VM
Process finished with exit code 0