Debugger: A dirty fix for setting breakpoints inside finally {} in case if exception is thrown from try {} (#KT-22654)

This commit is contained in:
Yan Zhulanow
2018-03-02 20:58:49 +03:00
parent eec9c6bffa
commit 966480a155
7 changed files with 92 additions and 7 deletions
@@ -0,0 +1,49 @@
package finallyBlock
fun throwException() { throw RuntimeException() }
fun foo() {}
fun main(args: Array<String>) {
fun wrap(f: () -> Unit) = try { f() } catch (e: Throwable) {}
wrap(::test1)
wrap(::test2)
wrap(::test3)
}
fun test1() {
try {
//Breakpoint!
throwException()
} finally {
//Breakpoint!
foo()
}
}
fun test2() {
try {
//Breakpoint!
foo()
} finally {
//Breakpoint!
foo()
}
}
fun test3() {
try {
//Breakpoint!
throwException()
} finally {
//Breakpoint!
try {
throwException()
} finally {
//Breakpoint!
foo()
}
}
}
// RESUME: 7
@@ -0,0 +1,19 @@
LineBreakpoint created at finallyBlock.kt:17
LineBreakpoint created at finallyBlock.kt:20
LineBreakpoint created at finallyBlock.kt:27
LineBreakpoint created at finallyBlock.kt:30
LineBreakpoint created at finallyBlock.kt:37
LineBreakpoint created at finallyBlock.kt:40
LineBreakpoint created at finallyBlock.kt:44
Run Java
Connected to the target VM
finallyBlock.kt:17
finallyBlock.kt:20
finallyBlock.kt:27
finallyBlock.kt:30
finallyBlock.kt:37
finallyBlock.kt:40
finallyBlock.kt:44
Disconnected from the target VM
Process finished with exit code 0