Step over for suspended calls (KT-18453)
Debugger do the normal step over action and checks if function is going to suspend. In this case the "run-to-cursor" breakpoint is installed on function enter to intercept re-enter into function after suspension. #KT-18453 In Progress
This commit is contained in:
@@ -15,4 +15,8 @@ fun main(args: Array<String>) {
|
||||
builder {
|
||||
first()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// STEP_INTO: 1
|
||||
|
||||
// TODO: Breakpoint on builder {} is now triggered twice. This is because generated line number on suspend function enter.
|
||||
@@ -2,6 +2,7 @@ LineBreakpoint created at coroutine.kt:15
|
||||
Run Java
|
||||
Connected to the target VM
|
||||
coroutine.kt:15
|
||||
coroutine.kt:15
|
||||
coroutine.kt:16
|
||||
Disconnected from the target VM
|
||||
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package stepIntoSuspendFunctionSimple
|
||||
|
||||
import forTests.builder
|
||||
|
||||
private fun foo() {}
|
||||
|
||||
suspend fun second() {
|
||||
}
|
||||
|
||||
suspend fun first(): Int {
|
||||
second()
|
||||
return 12
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
builder {
|
||||
//Breakpoint!
|
||||
first()
|
||||
foo()
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
LineBreakpoint created at stepIntoSuspendFunctionSimple.kt:18
|
||||
Run Java
|
||||
Connected to the target VM
|
||||
stepIntoSuspendFunctionSimple.kt:18
|
||||
stepIntoSuspendFunctionSimple.kt:10
|
||||
Disconnected from the target VM
|
||||
|
||||
Process finished with exit code 0
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package soNonSuspendableSuspendCall
|
||||
|
||||
import forTests.builder
|
||||
|
||||
private fun foo() {}
|
||||
|
||||
suspend fun second() {
|
||||
}
|
||||
|
||||
suspend fun first(): Int {
|
||||
second()
|
||||
return 12
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
builder {
|
||||
//Breakpoint!
|
||||
first()
|
||||
foo()
|
||||
}
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
LineBreakpoint created at soNonSuspendableSuspendCall.kt:18
|
||||
Run Java
|
||||
Connected to the target VM
|
||||
soNonSuspendableSuspendCall.kt:18
|
||||
soNonSuspendableSuspendCall.kt:19
|
||||
Disconnected from the target VM
|
||||
|
||||
Process finished with exit code 0
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package soSuspendableCallInEndOfFun
|
||||
|
||||
import forTests.builder
|
||||
import kotlin.coroutines.experimental.Continuation
|
||||
import kotlin.coroutines.experimental.suspendCoroutine
|
||||
|
||||
private fun foo(a: Any) {}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
builder {
|
||||
inFun()
|
||||
}
|
||||
|
||||
foo("Main end")
|
||||
Thread.sleep(100)
|
||||
}
|
||||
|
||||
suspend fun inFun() {
|
||||
foo("Start")
|
||||
//Breakpoint!
|
||||
run()
|
||||
}
|
||||
|
||||
suspend fun run() {
|
||||
suspendCoroutine { cont: Continuation<Unit> ->
|
||||
Thread {
|
||||
cont.resume(Unit)
|
||||
Thread.sleep(10)
|
||||
}.start()
|
||||
}
|
||||
}
|
||||
|
||||
// STEP_OVER: 4
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
LineBreakpoint created at soSuspendableCallInEndOfFun.kt:21
|
||||
Run Java
|
||||
Connected to the target VM
|
||||
soSuspendableCallInEndOfFun.kt:21
|
||||
soSuspendableCallInEndOfFun.kt:18
|
||||
soSuspendableCallInEndOfFun.kt:22
|
||||
soSuspendableCallInEndOfFun.kt:-1
|
||||
soSuspendableCallInEndOfFun.kt:28
|
||||
Disconnected from the target VM
|
||||
|
||||
Process finished with exit code 0
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package soSuspendableCallInEndOfLambda
|
||||
|
||||
import forTests.builder
|
||||
import kotlin.coroutines.experimental.Continuation
|
||||
import kotlin.coroutines.experimental.suspendCoroutine
|
||||
|
||||
private fun foo(a: Any) {}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
builder {
|
||||
foo("Start")
|
||||
//Breakpoint!
|
||||
run()
|
||||
}
|
||||
|
||||
foo("Main end")
|
||||
Thread.sleep(100)
|
||||
}
|
||||
|
||||
suspend fun run() {
|
||||
suspendCoroutine { cont: Continuation<Unit> ->
|
||||
Thread {
|
||||
cont.resume(Unit)
|
||||
Thread.sleep(10)
|
||||
}.start()
|
||||
}
|
||||
}
|
||||
|
||||
// STEP_OVER: 2
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
LineBreakpoint created at soSuspendableCallInEndOfLambda.kt:13
|
||||
Run Java
|
||||
Connected to the target VM
|
||||
soSuspendableCallInEndOfLambda.kt:13
|
||||
soSuspendableCallInEndOfLambda.kt:10
|
||||
soSuspendableCallInEndOfLambda.kt:14
|
||||
Disconnected from the target VM
|
||||
|
||||
Process finished with exit code 0
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package soSuspendableCallInFun
|
||||
|
||||
import forTests.builder
|
||||
import kotlin.coroutines.experimental.Continuation
|
||||
import kotlin.coroutines.experimental.suspendCoroutine
|
||||
|
||||
private fun foo(a: Any) {}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
builder {
|
||||
inFun()
|
||||
}
|
||||
|
||||
foo("Main end")
|
||||
Thread.sleep(100)
|
||||
}
|
||||
|
||||
suspend fun inFun() {
|
||||
//Breakpoint!
|
||||
run()
|
||||
foo("End")
|
||||
}
|
||||
|
||||
suspend fun run() {
|
||||
suspendCoroutine { cont: Continuation<Unit> ->
|
||||
Thread {
|
||||
cont.resume(Unit)
|
||||
Thread.sleep(10)
|
||||
}.start()
|
||||
}
|
||||
}
|
||||
|
||||
// STEP_OVER: 2
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
LineBreakpoint created at soSuspendableCallInFun.kt:20
|
||||
Run Java
|
||||
Connected to the target VM
|
||||
soSuspendableCallInFun.kt:20
|
||||
soSuspendableCallInFun.kt:18
|
||||
soSuspendableCallInFun.kt:21
|
||||
Disconnected from the target VM
|
||||
|
||||
Process finished with exit code 0
|
||||
Vendored
+34
@@ -0,0 +1,34 @@
|
||||
package soSuspendableCallInFunFromOtherStepping
|
||||
|
||||
import forTests.builder
|
||||
import kotlin.coroutines.experimental.Continuation
|
||||
import kotlin.coroutines.experimental.suspendCoroutine
|
||||
|
||||
private fun foo(a: Any) {}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
builder {
|
||||
inFun()
|
||||
}
|
||||
|
||||
foo("Main end")
|
||||
Thread.sleep(120)
|
||||
}
|
||||
|
||||
suspend fun inFun() {
|
||||
//Breakpoint!
|
||||
foo("Start")
|
||||
run()
|
||||
foo("End")
|
||||
}
|
||||
|
||||
suspend fun run() {
|
||||
return suspendCoroutine { cont: Continuation<Unit> ->
|
||||
Thread {
|
||||
cont.resume(Unit)
|
||||
Thread.sleep(10)
|
||||
}.start()
|
||||
}
|
||||
}
|
||||
|
||||
// STEP_OVER: 3
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
LineBreakpoint created at soSuspendableCallInFunFromOtherStepping.kt:20
|
||||
Run Java
|
||||
Connected to the target VM
|
||||
soSuspendableCallInFunFromOtherStepping.kt:20
|
||||
soSuspendableCallInFunFromOtherStepping.kt:21
|
||||
soSuspendableCallInFunFromOtherStepping.kt:18
|
||||
soSuspendableCallInFunFromOtherStepping.kt:22
|
||||
Disconnected from the target VM
|
||||
|
||||
Process finished with exit code 0
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package soSuspendableCallInLambda
|
||||
|
||||
import forTests.builder
|
||||
import kotlin.coroutines.experimental.Continuation
|
||||
import kotlin.coroutines.experimental.suspendCoroutine
|
||||
|
||||
private fun foo(a: Any) {}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
builder {
|
||||
//Breakpoint!
|
||||
run()
|
||||
foo("End")
|
||||
}
|
||||
|
||||
foo("Main end")
|
||||
Thread.sleep(100)
|
||||
}
|
||||
|
||||
suspend fun run() {
|
||||
suspendCoroutine { cont: Continuation<Unit> ->
|
||||
Thread {
|
||||
cont.resume(Unit)
|
||||
Thread.sleep(10)
|
||||
}.start()
|
||||
}
|
||||
}
|
||||
|
||||
// STEP_OVER: 2
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
LineBreakpoint created at soSuspendableCallInLambda.kt:12
|
||||
Run Java
|
||||
Connected to the target VM
|
||||
soSuspendableCallInLambda.kt:12
|
||||
soSuspendableCallInLambda.kt:10
|
||||
soSuspendableCallInLambda.kt:13
|
||||
Disconnected from the target VM
|
||||
|
||||
Process finished with exit code 0
|
||||
Reference in New Issue
Block a user