Debugger: A dirty fix for setting breakpoints inside finally {} in case if exception is thrown from try {} (#KT-22654)
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user