Proper generate interval for catch block variable; Fix for KT-15646: InconsistentDebugInfoException when stepping over throw

#KT-15646 Fixed
This commit is contained in:
Mikhael Bogdanov
2017-01-18 14:36:27 +01:00
parent 4ab6b6954d
commit e1bec0df2e
5 changed files with 49 additions and 3 deletions
@@ -4358,6 +4358,9 @@ The "returned" value of try expression with no finally is either the last expres
int index = lookupLocalIndex(descriptor);
v.store(index, descriptorType);
Label catchVariableStart = new Label();
v.mark(catchVariableStart);
gen(catchBody, expectedAsmType);
if (!isStatement) {
@@ -4369,8 +4372,8 @@ The "returned" value of try expression with no finally is either the last expres
Label clauseEnd = new Label();
v.mark(clauseEnd);
v.visitLocalVariable(descriptor.getName().asString(), descriptorType.getDescriptor(), null, clauseStart, clauseEnd,
index);
v.visitLocalVariable(descriptor.getName().asString(), descriptorType.getDescriptor(), null,
catchVariableStart, clauseEnd, index);
genFinallyBlockOrGoto(finallyBlockStackElement, i != size - 1 || finallyBlock != null ? end : null, null);
+1 -1
View File
@@ -5,7 +5,7 @@ class A {
a++
}
catch(e : Throwable) {
e.printStackTrace()
}
}
}
+23
View File
@@ -0,0 +1,23 @@
LineBreakpoint created at catchVariable.kt:9
!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! catchVariable.CatchVariableKt
Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
catchVariable.kt:9
package catchVariable
fun main(args: Array<String>) {
try {
throw Exception()
}
//Breakpoint!
catch (e: Exception) {
}
}
// PRINT_FRAME
frame = main:9, CatchVariableKt {catchVariable}
local = args: java.lang.String[] = {java.lang.String[0]@uniqueID} (sp = catchVariable.kt, 3)
Disconnected from the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
Process finished with exit code 0
@@ -0,0 +1,14 @@
package catchVariable
fun main(args: Array<String>) {
try {
throw Exception()
}
//Breakpoint!
catch (e: Exception) {
}
}
// PRINT_FRAME
@@ -559,6 +559,12 @@ public class KotlinEvaluateExpressionTestGenerated extends AbstractKotlinEvaluat
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/frame"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true);
}
@TestMetadata("catchVariable.kt")
public void testCatchVariable() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/frame/catchVariable.kt");
doSingleBreakpointTest(fileName);
}
@TestMetadata("delegatedPropertyInClass.kt")
public void testDelegatedPropertyInClass() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/frame/delegatedPropertyInClass.kt");