[codegeneration][debug info] generates marker of inlined function body on call site
- makes debuger breakpoint resolution more accurate - restore expected behavior stack_trace_inline test - fixes kt-33055
This commit is contained in:
@@ -169,6 +169,15 @@ class K2Native : CLICompiler<K2NativeCompilerArguments>() {
|
|||||||
null
|
null
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
putIfNotNull(GENERATE_INLINED_FUNCTION_BODY_MARKER, when (val it = arguments.generateInlinedFunctionMarkerString) {
|
||||||
|
"enable" -> true
|
||||||
|
"disable" -> false
|
||||||
|
null -> null
|
||||||
|
else -> {
|
||||||
|
configuration.report(ERROR, "Unsupported -Xg-generate-inline-function-body-marker= value: $it. Possible values are 'enable'/'disable'")
|
||||||
|
null
|
||||||
|
}
|
||||||
|
})
|
||||||
put(STATIC_FRAMEWORK, selectFrameworkType(configuration, arguments, outputKind))
|
put(STATIC_FRAMEWORK, selectFrameworkType(configuration, arguments, outputKind))
|
||||||
put(OVERRIDE_CLANG_OPTIONS, arguments.clangOptions.toNonNullList())
|
put(OVERRIDE_CLANG_OPTIONS, arguments.clangOptions.toNonNullList())
|
||||||
put(ALLOCATION_MODE, arguments.allocator)
|
put(ALLOCATION_MODE, arguments.allocator)
|
||||||
|
|||||||
+8
@@ -165,6 +165,14 @@ class K2NativeCompilerArguments : CommonCompilerArguments() {
|
|||||||
@Argument(value = "-Xg0", description = "Add light debug information. Deprecated option. Please use instead -Xadd-light-debug=enable")
|
@Argument(value = "-Xg0", description = "Add light debug information. Deprecated option. Please use instead -Xadd-light-debug=enable")
|
||||||
var lightDebugDeprecated: Boolean = false
|
var lightDebugDeprecated: Boolean = false
|
||||||
|
|
||||||
|
@Argument(
|
||||||
|
value = "-Xg-generate-inline-function-body-marker",
|
||||||
|
valueDescription = "{disable|enable}",
|
||||||
|
description = """generates marker of inlined function body on call site to make debugger breakpoint resolution more accurate"""
|
||||||
|
)
|
||||||
|
var generateInlinedFunctionMarkerString: String? = null
|
||||||
|
|
||||||
|
|
||||||
@Argument(
|
@Argument(
|
||||||
value = MAKE_CACHE,
|
value = MAKE_CACHE,
|
||||||
valueDescription = "<path>",
|
valueDescription = "<path>",
|
||||||
|
|||||||
+1
@@ -43,6 +43,7 @@ class KonanConfig(val project: Project, val configuration: CompilerConfiguration
|
|||||||
val debug: Boolean get() = configuration.getBoolean(KonanConfigKeys.DEBUG)
|
val debug: Boolean get() = configuration.getBoolean(KonanConfigKeys.DEBUG)
|
||||||
val lightDebug: Boolean = configuration.get(KonanConfigKeys.LIGHT_DEBUG)
|
val lightDebug: Boolean = configuration.get(KonanConfigKeys.LIGHT_DEBUG)
|
||||||
?: target.family.isAppleFamily // Default is true for Apple targets.
|
?: target.family.isAppleFamily // Default is true for Apple targets.
|
||||||
|
val generateInlinedBodyTrampoline = debug && configuration.get(KonanConfigKeys.GENERATE_INLINED_FUNCTION_BODY_MARKER) ?: false
|
||||||
|
|
||||||
val memoryModel: MemoryModel get() = configuration.get(KonanConfigKeys.MEMORY_MODEL)!!
|
val memoryModel: MemoryModel get() = configuration.get(KonanConfigKeys.MEMORY_MODEL)!!
|
||||||
val destroyRuntimeMode: DestroyRuntimeMode get() = configuration.get(KonanConfigKeys.DESTROY_RUNTIME_MODE)!!
|
val destroyRuntimeMode: DestroyRuntimeMode get() = configuration.get(KonanConfigKeys.DESTROY_RUNTIME_MODE)!!
|
||||||
|
|||||||
+2
@@ -56,6 +56,8 @@ class KonanConfigKeys {
|
|||||||
= CompilerConfigurationKey.create("library version")
|
= CompilerConfigurationKey.create("library version")
|
||||||
val LIGHT_DEBUG: CompilerConfigurationKey<Boolean?>
|
val LIGHT_DEBUG: CompilerConfigurationKey<Boolean?>
|
||||||
= CompilerConfigurationKey.create("add light debug information")
|
= CompilerConfigurationKey.create("add light debug information")
|
||||||
|
val GENERATE_INLINED_FUNCTION_BODY_MARKER: CompilerConfigurationKey<Boolean?>
|
||||||
|
= CompilerConfigurationKey.create("generates inlined function body marker on call site")
|
||||||
val LINKER_ARGS: CompilerConfigurationKey<List<String>>
|
val LINKER_ARGS: CompilerConfigurationKey<List<String>>
|
||||||
= CompilerConfigurationKey.create("additional linker arguments")
|
= CompilerConfigurationKey.create("additional linker arguments")
|
||||||
val LIST_PHASES: CompilerConfigurationKey<Boolean>
|
val LIST_PHASES: CompilerConfigurationKey<Boolean>
|
||||||
|
|||||||
+6
-1
@@ -1823,11 +1823,16 @@ internal class CodeGeneratorVisitor(val context: Context, val lifetimes: Map<IrE
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------//
|
//-------------------------------------------------------------------------//
|
||||||
|
|
||||||
private fun evaluateReturnableBlock(value: IrReturnableBlock): LLVMValueRef {
|
private fun evaluateReturnableBlock(value: IrReturnableBlock): LLVMValueRef {
|
||||||
context.log{"evaluateReturnableBlock : ${value.statements.forEach { ir2string(it) }}"}
|
context.log{"evaluateReturnableBlock : ${value.statements.forEach { ir2string(it) }}"}
|
||||||
|
|
||||||
val returnableBlockScope = ReturnableBlockScope(value)
|
val returnableBlockScope = ReturnableBlockScope(value)
|
||||||
|
val generationContext = (currentCodeContext.functionScope() as? FunctionScope)?.functionGenerationContext
|
||||||
|
.takeIf { context.config.generateInlinedBodyTrampoline }
|
||||||
|
generationContext?.basicBlock("inline", value.startLocation)?.let {
|
||||||
|
generationContext.br(it)
|
||||||
|
generationContext.positionAtEnd(it)
|
||||||
|
}
|
||||||
using(returnableBlockScope) {
|
using(returnableBlockScope) {
|
||||||
using(VariableScope()) {
|
using(VariableScope()) {
|
||||||
value.statements.forEach {
|
value.statements.forEach {
|
||||||
|
|||||||
Reference in New Issue
Block a user