Debugger: Tests refactor

This commit is contained in:
Aleksandr Prokopyev
2019-10-15 11:39:27 +03:00
committed by Vladimir Ilmov
parent 12313fa5aa
commit 1dc44b4000
22 changed files with 472 additions and 1 deletions
@@ -0,0 +1,20 @@
package frameLambdaNotAccessible
fun main() {
val k = "lorem"
bar()()
}
fun bar(): () -> Unit {
val k = "ipsum"
return {
val l = "doloret"
//Breakpoint!
Unit
}
}
// PRINT_FRAME
// EXPRESSION: k
// RESULT: 'k' is not captured
@@ -0,0 +1,21 @@
LineBreakpoint created at frameLambdaNotAccessible.kt:13
Run Java
Connected to the target VM
frameLambdaNotAccessible.kt:13
Compile bytecode for k
frame = invoke:13, FrameLambdaNotAccessibleKt$bar$1 {frameLambdaNotAccessible}
this = this = {frameLambdaNotAccessible.FrameLambdaNotAccessibleKt$bar$1@uniqueID}Function0<kotlin.Unit>
field = arity: int = 0 (sp = Lambda.!EXT!)
local = l: java.lang.String = doloret (sp = frameLambdaNotAccessible.kt, 11)
field = value: char[] = {char[7]@uniqueID} (sp = String.!EXT!)
element = 0 = 'd' 100
element = 1 = 'o' 111
element = 2 = 'l' 108
element = 3 = 'o' 111
element = 4 = 'r' 114
element = 5 = 'e' 101
element = 6 = 't' 116
field = hash: int = 0 (sp = String.!EXT!)
Disconnected from the target VM
Process finished with exit code 0
@@ -0,0 +1,27 @@
package frameLambdaVariableFromCorrectFrame
fun main() {
val k = "lorem"
foo {
val j = "ipsum"
{
val l = 5
//Breakpoint!
Unit
}()
}
}
fun foo(block: () -> Any?) {
val k = "doloret"
val j = "sit"
block()
}
// PRINT_FRAME
// EXPRESSION: k
// RESULT: "lorem": Ljava/lang/String;
// EXPRESSION: j
// RESULT: "ipsum": Ljava/lang/String;
@@ -0,0 +1,13 @@
LineBreakpoint created at frameLambdaVariableFromCorrectFrame.kt:10
Run Java
Connected to the target VM
frameLambdaVariableFromCorrectFrame.kt:10
Compile bytecode for k
Compile bytecode for j
frame = invoke:10, FrameLambdaVariableFromCorrectFrameKt$main$1$1 {frameLambdaVariableFromCorrectFrame}
this = this = {frameLambdaVariableFromCorrectFrame.FrameLambdaVariableFromCorrectFrameKt$main$1$1@uniqueID}Function0<kotlin.Unit>
field = arity: int = 0 (sp = Lambda.!EXT!)
local = l: int = 5 (sp = frameLambdaVariableFromCorrectFrame.kt, 8)
Disconnected from the target VM
Process finished with exit code 0
@@ -0,0 +1,28 @@
package nonCapturedThisInLambda
fun main() {
Foo().bar()
}
class Foo {
val a = "lorem"
val b: String
get() = "ipsum"
fun bar() {
{
//Breakpoint!
Unit
}()
}
}
// PRINT_FRAME
// EXPRESSION: a
// RESULT: "lorem": Ljava/lang/String;
// EXPRESSION: b
// RESULT: "ipsum": Ljava/lang/String;
// EXPRESSION: this
// RESULT: instance of nonCapturedThisInLambda.Foo(id=ID): LnonCapturedThisInLambda/Foo;
@@ -0,0 +1,13 @@
LineBreakpoint created at nonCapturedThisInLambda.kt:14
Run Java
Connected to the target VM
nonCapturedThisInLambda.kt:14
Compile bytecode for a
Compile bytecode for b
Compile bytecode for this
frame = invoke:14, Foo$bar$1 {nonCapturedThisInLambda}
this = this = {nonCapturedThisInLambda.Foo$bar$1@uniqueID}Function0<kotlin.Unit>
field = arity: int = 0 (sp = Lambda.!EXT!)
Disconnected from the target VM
Process finished with exit code 0