Proper generate interval for catch block variable; Fix for KT-15646: InconsistentDebugInfoException when stepping over throw
#KT-15646 Fixed
This commit is contained in:
@@ -4358,6 +4358,9 @@ The "returned" value of try expression with no finally is either the last expres
|
|||||||
int index = lookupLocalIndex(descriptor);
|
int index = lookupLocalIndex(descriptor);
|
||||||
v.store(index, descriptorType);
|
v.store(index, descriptorType);
|
||||||
|
|
||||||
|
Label catchVariableStart = new Label();
|
||||||
|
v.mark(catchVariableStart);
|
||||||
|
|
||||||
gen(catchBody, expectedAsmType);
|
gen(catchBody, expectedAsmType);
|
||||||
|
|
||||||
if (!isStatement) {
|
if (!isStatement) {
|
||||||
@@ -4369,8 +4372,8 @@ The "returned" value of try expression with no finally is either the last expres
|
|||||||
Label clauseEnd = new Label();
|
Label clauseEnd = new Label();
|
||||||
v.mark(clauseEnd);
|
v.mark(clauseEnd);
|
||||||
|
|
||||||
v.visitLocalVariable(descriptor.getName().asString(), descriptorType.getDescriptor(), null, clauseStart, clauseEnd,
|
v.visitLocalVariable(descriptor.getName().asString(), descriptorType.getDescriptor(), null,
|
||||||
index);
|
catchVariableStart, clauseEnd, index);
|
||||||
|
|
||||||
genFinallyBlockOrGoto(finallyBlockStackElement, i != size - 1 || finallyBlock != null ? end : null, null);
|
genFinallyBlockOrGoto(finallyBlockStackElement, i != size - 1 || finallyBlock != null ? end : null, null);
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ class A {
|
|||||||
a++
|
a++
|
||||||
}
|
}
|
||||||
catch(e : Throwable) {
|
catch(e : Throwable) {
|
||||||
|
e.printStackTrace()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
+14
@@ -0,0 +1,14 @@
|
|||||||
|
package catchVariable
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
try {
|
||||||
|
throw Exception()
|
||||||
|
|
||||||
|
}
|
||||||
|
//Breakpoint!
|
||||||
|
catch (e: Exception) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// PRINT_FRAME
|
||||||
+6
@@ -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);
|
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")
|
@TestMetadata("delegatedPropertyInClass.kt")
|
||||||
public void testDelegatedPropertyInClass() throws Exception {
|
public void testDelegatedPropertyInClass() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/frame/delegatedPropertyInClass.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/evaluate/singleBreakpoint/frame/delegatedPropertyInClass.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user