Debugger: write line number for catch clause declaration
This commit is contained in:
@@ -192,6 +192,7 @@ Issues fixed:
|
||||
- Avoid cast to runtime type unavailable in current scope
|
||||
- Fix text with line breaks in popup with line breakpoint variants
|
||||
- Fix breakpoints inside inline functions in libraries sources
|
||||
- Allow breakpoints at catch clause declaration
|
||||
|
||||
### Java to Kotlin converter
|
||||
|
||||
|
||||
@@ -3667,6 +3667,11 @@ The "returned" value of try expression with no finally is either the last expres
|
||||
Label clauseStart = new Label();
|
||||
v.mark(clauseStart);
|
||||
|
||||
KtExpression catchBody = clause.getCatchBody();
|
||||
if (catchBody != null) {
|
||||
markLineNumber(catchBody, false);
|
||||
}
|
||||
|
||||
VariableDescriptor descriptor = bindingContext.get(VALUE_PARAMETER, clause.getCatchParameter());
|
||||
assert descriptor != null;
|
||||
Type descriptorType = asmType(descriptor.getType());
|
||||
@@ -3674,7 +3679,7 @@ The "returned" value of try expression with no finally is either the last expres
|
||||
int index = lookupLocalIndex(descriptor);
|
||||
v.store(index, descriptorType);
|
||||
|
||||
gen(clause.getCatchBody(), expectedAsmType);
|
||||
gen(catchBody, expectedAsmType);
|
||||
|
||||
if (!isStatement) {
|
||||
v.store(savedValue, expectedAsmType);
|
||||
|
||||
@@ -12,4 +12,4 @@ fun foo() {
|
||||
}
|
||||
}
|
||||
|
||||
// 2 3 5 6 8 9 11 8 13
|
||||
// 2 3 4 5 6 8 9 10 11 8 13
|
||||
+1
-1
@@ -16,4 +16,4 @@ fun foo() {
|
||||
}
|
||||
}
|
||||
|
||||
// 2 3 7 5 7 8 10 11 15 13 15 10 17
|
||||
// 2 3 7 4 5 7 8 10 11 15 12 13 15 10 17
|
||||
@@ -0,0 +1,9 @@
|
||||
LineBreakpoint created at stepOverCatchClause.kt:14
|
||||
!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! stepOverCatchClause.StepOverCatchClauseKt
|
||||
Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
|
||||
stepOverCatchClause.kt:14
|
||||
stepOverCatchClause.kt:7
|
||||
stepOverCatchClause.kt:8
|
||||
Disconnected from the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket'
|
||||
|
||||
Process finished with exit code 0
|
||||
@@ -8,11 +8,13 @@ stepOverTryCatchWithInline.kt:48
|
||||
stepOverTryCatchWithInline.kt:17
|
||||
stepOverTryCatchWithInline.kt:24
|
||||
stepOverTryCatchWithInline.kt:25
|
||||
stepOverTryCatchWithInline.kt:27
|
||||
stepOverTryCatchWithInline.kt:28
|
||||
stepOverTryCatchWithInline.kt:35
|
||||
stepOverTryCatchWithInline.kt:36
|
||||
stepOverTryCatchWithInline.kt:48
|
||||
stepOverTryCatchWithInline.kt:36
|
||||
stepOverTryCatchWithInline.kt:38
|
||||
stepOverTryCatchWithInline.kt:39
|
||||
stepOverTryCatchWithInline.kt:43
|
||||
stepOverTryCatchWithInline.kt:8
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package stepOverCatchClause
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
try {
|
||||
bar()
|
||||
}
|
||||
catch(e: Exception) {
|
||||
val a = e
|
||||
}
|
||||
}
|
||||
|
||||
fun bar() {
|
||||
//Breakpoint!
|
||||
throw IllegalStateException()
|
||||
}
|
||||
|
||||
// STEP_OVER: 2
|
||||
+1
-1
@@ -51,4 +51,4 @@ inline fun foo(f: () -> Int): Int {
|
||||
|
||||
fun test(i: Int) = 1
|
||||
|
||||
// STEP_OVER: 15
|
||||
// STEP_OVER: 19
|
||||
@@ -379,6 +379,12 @@ public class KotlinSteppingTestGenerated extends AbstractKotlinSteppingTest {
|
||||
doStepOverTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("stepOverCatchClause.kt")
|
||||
public void testStepOverCatchClause() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepping/stepOver/stepOverCatchClause.kt");
|
||||
doStepOverTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("stepOverForWithInline.kt")
|
||||
public void testStepOverForWithInline() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/debugger/tinyApp/src/stepping/stepOver/stepOverForWithInline.kt");
|
||||
|
||||
Reference in New Issue
Block a user