Skip to content

Commit

Permalink
[K/N] Add debugCompilationDir option akin to -fdebug-compilation-dir
Browse files Browse the repository at this point in the history
When using -Xdebug-prefix-map in K/N, Apple's linker (ld-prime) seems
to discard the produced debug information because of the empty
DW_AT_comp_dir value.

To mitigate that, there should be a way to modify this value.

This commit adds -Xbinary=debugCompilationDir=$dir option, similar
to -fdebug-compilation-dir in Clang. The compiler propagates the
specified value to DW_AT_comp_dir.

^KT-73306 Fixed
  • Loading branch information
MarkCMann authored and qodana-bot committed Nov 22, 2024
1 parent 593edb7 commit 4661f6c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ object BinaryOptions : BinaryOptionRegistry() {
val preCodegenInlineThreshold by uintOption()

val enableDebugTransparentStepping by booleanOption()

val debugCompilationDir by stringOption()
}

open class BinaryOption<T : Any>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ internal class DebugInfo(override val generationState: NativeGenerationState) :
// we don't split path to filename and directory to provide enough level uniquely for dsymutil to avoid symbol
// clashing, which happens on linking with libraries produced from intercepting sources.
File = path.path(),
dir = "",
dir = config.configuration.get(BinaryOptions.debugCompilationDir) ?: "",
producer = DWARF.producer,
isOptimized = 0,
flags = "",
Expand Down

0 comments on commit 4661f6c

Please sign in to comment.