Add line numbers for suspend function to enhance stepping (KT-16025)

Stop at function start on step into.
Step at function end on step out.

Both cases should actually be skipped by debugger, but this is postponed
till new backend generation for suspend functions is ready.

 #KT-16025 Fixed
This commit is contained in:
Nikolay Krasko
2017-03-23 16:31:46 +03:00
parent 8cfcd7e5a6
commit 0d5913287f
6 changed files with 113 additions and 8 deletions
+14
View File
@@ -0,0 +1,14 @@
LineBreakpoint created at siSuspendFun.kt:29
Run Java
Connected to the target VM
siSuspendFun.kt:29
siSuspendFun.kt:21
siSuspendFun.kt:22
siSuspendFun.kt:18
siSuspendFun.kt:18
siSuspendFun.kt:14
siSuspendFun.kt:10
siSuspendFun.kt:6
Disconnected from the target VM
Process finished with exit code 0
+14
View File
@@ -0,0 +1,14 @@
LineBreakpoint created at souSuspendFun.kt:7
Run Java
Connected to the target VM
souSuspendFun.kt:7
souSuspendFun.kt:11
souSuspendFun.kt:15
souSuspendFun.kt:19
souSuspendFun.kt:19
souSuspendFun.kt:23
souSuspendFun.kt:25
souSuspendFun.kt:29
Disconnected from the target VM
Process finished with exit code 0
@@ -0,0 +1,34 @@
package siSuspendFun
import forTests.builder
private fun foo(): Int {
return 42 // 8
}
// One line suspend wihtout doResume
suspend fun fourth() = foo() // 7
// Multiline suspend without doResume
suspend fun third() : Int? {
return fourth() // 6
}
// One line suspend with doResume
suspend fun second(): Int = third()?.let { return it } ?: 0 // 4 (FIX IT!) 5
// Multiline suspend with doResume
suspend fun first(): Int { // 2 (FIX IT!)
second() // 3
return 12
}
fun main(args: Array<String>) {
builder {
//Breakpoint!
first() // 1
foo()
}
}
// STEP_INTO: 7
@@ -0,0 +1,33 @@
package souSuspendFun
import forTests.builder
private fun foo(): Int {
//Breakpoint!
return 42 // 1
}
// One line suspend wihtout doResume
suspend fun fourth() = foo() // 2
// Multiline suspend without doResume
suspend fun third() : Int? {
return fourth() // 3
}
// One line suspend with doResume
suspend fun second(): Int = third()?.let { return it } ?: 0 // 4 5 (FIX IT)
// Multiline suspend with doResume
suspend fun first(): Int {
second() // 6
return 12
} // 7 (FIX IT)
fun main(args: Array<String>) {
builder {
first() // 8
}
}
// STEP_OUT: 7