From 649ec9a73d93c23923fccc77582f6e8be46cad75 Mon Sep 17 00:00:00 2001 From: Nikolay Krasko Date: Mon, 23 Jan 2017 15:40:19 +0300 Subject: [PATCH] Check that breakpoints work in suspend function without suspension points --- ...opInSuspendFunctionWithoutSuspendPoints.out | 8 ++++++++ .../tinyApp/src/forTests/coroutines.kt | 16 ++++++++++++++++ ...topInSuspendFunctionWithoutSuspendPoints.kt | 18 ++++++++++++++++++ .../debugger/KotlinSteppingTestGenerated.java | 6 ++++++ 4 files changed, 48 insertions(+) create mode 100644 idea/testData/debugger/tinyApp/outs/stopInSuspendFunctionWithoutSuspendPoints.out create mode 100644 idea/testData/debugger/tinyApp/src/forTests/coroutines.kt create mode 100644 idea/testData/debugger/tinyApp/src/stepping/stepOver/stopInSuspendFunctionWithoutSuspendPoints.kt diff --git a/idea/testData/debugger/tinyApp/outs/stopInSuspendFunctionWithoutSuspendPoints.out b/idea/testData/debugger/tinyApp/outs/stopInSuspendFunctionWithoutSuspendPoints.out new file mode 100644 index 00000000000..d35e860afe4 --- /dev/null +++ b/idea/testData/debugger/tinyApp/outs/stopInSuspendFunctionWithoutSuspendPoints.out @@ -0,0 +1,8 @@ +LineBreakpoint created at stopInSuspendFunctionWithoutSuspendPoints.kt:11 +!JDK_HOME!\bin\java -agentlib:jdwp=transport=dt_socket,address=!HOST_NAME!:!HOST_PORT!,suspend=y,server=n -Dfile.encoding=!FILE_ENCODING! -classpath !OUTPUT_PATH!;!KOTLIN_RUNTIME!;!CUSTOM_LIBRARY!;!RT_JAR! stopInSuspendFunctionWithoutSuspendPoints.StopInSuspendFunctionWithoutSuspendPointsKt +Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket' +stopInSuspendFunctionWithoutSuspendPoints.kt:11 +stopInSuspendFunctionWithoutSuspendPoints.kt:12 +Disconnected from the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket' + +Process finished with exit code 0 diff --git a/idea/testData/debugger/tinyApp/src/forTests/coroutines.kt b/idea/testData/debugger/tinyApp/src/forTests/coroutines.kt new file mode 100644 index 00000000000..094c5ac48ec --- /dev/null +++ b/idea/testData/debugger/tinyApp/src/forTests/coroutines.kt @@ -0,0 +1,16 @@ +package forTests + +import kotlin.coroutines.Continuation +import kotlin.coroutines.CoroutineContext +import kotlin.coroutines.EmptyCoroutineContext +import kotlin.coroutines.startCoroutine + +open class EmptyContinuation(override val context: CoroutineContext = EmptyCoroutineContext) : Continuation { + companion object : EmptyContinuation() + override fun resume(data: Any?) {} + override fun resumeWithException(exception: Throwable) { throw exception } +} + +fun builder(c: suspend () -> Unit) { + c.startCoroutine(EmptyContinuation) +} diff --git a/idea/testData/debugger/tinyApp/src/stepping/stepOver/stopInSuspendFunctionWithoutSuspendPoints.kt b/idea/testData/debugger/tinyApp/src/stepping/stepOver/stopInSuspendFunctionWithoutSuspendPoints.kt new file mode 100644 index 00000000000..d28f6a1129e --- /dev/null +++ b/idea/testData/debugger/tinyApp/src/stepping/stepOver/stopInSuspendFunctionWithoutSuspendPoints.kt @@ -0,0 +1,18 @@ +package stopInSuspendFunctionWithoutSuspendPoints + +import forTests.builder + +fun foo(a: Any) {} + +suspend fun first() { + foo("first") + + //Breakpoint! + foo("second") +} + +fun main(args: Array) { + builder { + first() + } +} \ No newline at end of file diff --git a/idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinSteppingTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinSteppingTestGenerated.java index 9fabd8e74a5..ec77e1c36fa 100644 --- a/idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinSteppingTestGenerated.java +++ b/idea/tests/org/jetbrains/kotlin/idea/debugger/KotlinSteppingTestGenerated.java @@ -818,6 +818,12 @@ public class KotlinSteppingTestGenerated extends AbstractKotlinSteppingTest { doStepOverTest(fileName); } + @TestMetadata("stopInSuspendFunctionWithoutSuspendPoints.kt") + public void testStopInSuspendFunctionWithoutSuspendPoints() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepping/stepOver/stopInSuspendFunctionWithoutSuspendPoints.kt"); + doStepOverTest(fileName); + } + @TestMetadata("stopInlineCallInLocalFunInSecondaryConstructor.kt") public void testStopInlineCallInLocalFunInSecondaryConstructor() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepping/stepOver/stopInlineCallInLocalFunInSecondaryConstructor.kt");