Debugger: wrong stepping through the loop with continue label

#KT-5776 Fixed
 #KT-5664 Fixed
This commit is contained in:
Natalia Ukhorskaya
2014-10-22 17:22:55 +04:00
parent ffba1b6fa0
commit d9ac8155da
8 changed files with 95 additions and 1 deletions
@@ -661,6 +661,8 @@ public class ExpressionCodegen extends JetVisitor<StackValue, StackValue> implem
}
public void afterBody(@NotNull Label loopExit) {
markLineNumber(forExpression);
increment(loopExit);
v.mark(bodyEnd);
@@ -591,6 +591,7 @@ fun main(args: Array<String>) {
testClass(javaClass<AbstractKotlinSteppingTest>()) {
model("debugger/tinyApp/src/stepInto/stepIntoAndSmartStepInto", testMethod = "doStepIntoTest", testClassName = "StepInto")
model("debugger/tinyApp/src/stepInto/stepIntoAndSmartStepInto", testMethod = "doSmartStepIntoTest", testClassName = "SmartStepInto")
model("debugger/tinyApp/src/stepInto/stepInto", testMethod = "doStepIntoTest", testClassName = "StepIntoOnly")
model("debugger/tinyApp/src/filters", testMethod = "doStepIntoTest")
}
@@ -0,0 +1,16 @@
LineBreakpoint created at continueLabel.kt:5
!JDK_HOME!\bin\java -agentlib:jdwp=transport=dt_socket,address=!HOST_NAME!:!HOST_PORT!,suspend=y,server=n -Dfile.encoding=!FILE_ENCODING! -classpath !APP_PATH!\classes;!KOTLIN_RUNTIME!;!CUSTOM_LIBRARY!;!RT_JAR! continueLabel.ContinueLabelPackage
Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
continueLabel.kt:5
continueLabel.kt:6
continueLabel.kt:7
continueLabel.kt:8
continueLabel.kt:5
continueLabel.kt:6
continueLabel.kt:7
continueLabel.kt:10
continueLabel.kt:5
continueLabel.kt:12
Disconnected from the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
Process finished with exit code 0
@@ -0,0 +1,21 @@
LineBreakpoint created at forLoop.kt:6
!JDK_HOME!\bin\java -agentlib:jdwp=transport=dt_socket,address=!HOST_NAME!:!HOST_PORT!,suspend=y,server=n -Dfile.encoding=!FILE_ENCODING! -classpath !APP_PATH!\classes;!KOTLIN_RUNTIME!;!CUSTOM_LIBRARY!;!RT_JAR! forLoop.ForLoopPackage
Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
forLoop.kt:6
forLoop.kt:7
forLoop.kt:8
forLoop.kt:7
forLoop.kt:8
forLoop.kt:7
forLoop.kt:10
forLoop.kt:11
forLoop.kt:12
forLoop.kt:13
forLoop.kt:11
forLoop.kt:12
forLoop.kt:13
forLoop.kt:11
forLoop.kt:15
Disconnected from the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
Process finished with exit code 0
@@ -0,0 +1,15 @@
package continueLabel
fun main(args: Array<String>) {
//Breakpoint!
for(el in 0..1) {
val a1 = 1
if (el == 0) {
continue
}
val a2 = 2
}
val a3 = 3
}
// STEP_INTO: 9
@@ -0,0 +1,18 @@
package forLoop
// KT-5664 Wrong stepping through for loop
fun main(args: Array<String>) {
//Breakpoint!
var x = 1
for (i in 0..1) {
x++
}
var y = 1
for (i in 0..1) {
y++
val y1 = y
}
val z = 1
}
// STEP_INTO: 14
@@ -28,7 +28,7 @@ import java.util.regex.Pattern;
/** This class is generated by {@link org.jetbrains.jet.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@InnerTestClasses({KotlinSteppingTestGenerated.StepInto.class, KotlinSteppingTestGenerated.SmartStepInto.class, KotlinSteppingTestGenerated.Filters.class})
@InnerTestClasses({KotlinSteppingTestGenerated.StepInto.class, KotlinSteppingTestGenerated.SmartStepInto.class, KotlinSteppingTestGenerated.StepIntoOnly.class, KotlinSteppingTestGenerated.Filters.class})
@RunWith(JUnit3RunnerWithInners.class)
public class KotlinSteppingTestGenerated extends AbstractKotlinSteppingTest {
@TestMetadata("idea/testData/debugger/tinyApp/src/stepInto/stepIntoAndSmartStepInto")
@@ -205,6 +205,27 @@ public class KotlinSteppingTestGenerated extends AbstractKotlinSteppingTest {
}
}
@TestMetadata("idea/testData/debugger/tinyApp/src/stepInto/stepInto")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class StepIntoOnly extends AbstractKotlinSteppingTest {
public void testAllFilesPresentInStepIntoOnly() throws Exception {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/debugger/tinyApp/src/stepInto/stepInto"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("continueLabel.kt")
public void testContinueLabel() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepInto/stepInto/continueLabel.kt");
doStepIntoTest(fileName);
}
@TestMetadata("forLoop.kt")
public void testForLoop() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepInto/stepInto/forLoop.kt");
doStepIntoTest(fileName);
}
}
@TestMetadata("idea/testData/debugger/tinyApp/src/filters")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)