Native: generate debug locations for catch parameters
^KT-50558 Fixed
This commit is contained in:
committed by
Space
parent
d74418f575
commit
a65b278f71
+9
-4
@@ -1216,7 +1216,7 @@ internal class CodeGeneratorVisitor(val context: Context, val lifetimes: Map<IrE
|
||||
for (catch in catches) {
|
||||
fun genCatchBlock() {
|
||||
using(VariableScope()) {
|
||||
currentCodeContext.genDeclareVariable(catch.catchParameter, exception, null)
|
||||
currentCodeContext.genDeclareVariable(catch.catchParameter, exception)
|
||||
functionGenerationContext.generateFrameCheck()
|
||||
evaluateExpressionAndJump(catch.result, success)
|
||||
}
|
||||
@@ -1455,11 +1455,16 @@ internal class CodeGeneratorVisitor(val context: Context, val lifetimes: Map<IrE
|
||||
}
|
||||
} ?: evaluateExpression(it)
|
||||
}
|
||||
currentCodeContext.genDeclareVariable(
|
||||
variable, value, debugInfoIfNeeded(
|
||||
(currentCodeContext.functionScope() as FunctionScope).declaration, variable))
|
||||
this.currentCodeContext.genDeclareVariable(variable, value)
|
||||
}
|
||||
|
||||
private fun CodeContext.genDeclareVariable(
|
||||
variable: IrVariable,
|
||||
value: LLVMValueRef?
|
||||
) = genDeclareVariable(
|
||||
variable, value, debugInfoIfNeeded(
|
||||
(functionScope() as FunctionScope).declaration, variable))
|
||||
|
||||
//-------------------------------------------------------------------------//
|
||||
|
||||
private fun evaluateTypeOperator(value: IrTypeOperatorCall): LLVMValueRef {
|
||||
|
||||
+31
@@ -126,6 +126,37 @@ class LldbTests {
|
||||
> 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 = """
|
||||
|
||||
Reference in New Issue
Block a user