From a65b278f711288a9b9e0d062b2b07df1fd6d90f3 Mon Sep 17 00:00:00 2001 From: Svyatoslav Scherbina Date: Fri, 21 Jan 2022 12:39:14 +0300 Subject: [PATCH] Native: generate debug locations for catch parameters ^KT-50558 Fixed --- .../kotlin/backend/konan/llvm/IrToBitcode.kt | 13 +++++--- .../kotlin/native/test/debugger/LldbTests.kt | 31 +++++++++++++++++++ 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt index 508b65ac03b..267e5d431a3 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/llvm/IrToBitcode.kt @@ -1216,7 +1216,7 @@ internal class CodeGeneratorVisitor(val context: Context, val lifetimes: Map q """) + @Test + fun `can inspect catch parameter`() = lldbTest(""" + fun main() { + try { + throw Exception("message 1") + } catch (e1: Throwable) { + println(e1.message) + } + + try { + throwError() + } catch (e2: Throwable) { + println(e2.message) + } + } + + fun throwError() { + throw Error("message 2") + } + """, """ + > b main.kt:5 + > ${lldbCommandRunOrContinue()} + > fr var + (ObjHeader *) e1 = [..] + > b main.kt:11 + > c + > fr var + (ObjHeader *) e2 = [..] + > q + """) + @Test fun `swift with kotlin static framework`() = lldbComplexTest { val aKtSrc = """