全部配置 / KN-XPHASES-TO-DUMP-BEFORE

Xphases-to-dump-before

Xphases-to-dump-before · KN-XPHASES-TO-DUMP-BEFORE · 编译器参数(Native)

重要:中 · 场景相关 默认:未设置(不传则空) 场合:排障诊断 来源:上游原样

默认值:未设置。未指定则为空。使用场合:排障诊断。排障诊断:定位编译或运行问题时短时开启,结束后应关闭。

它是做什么的

用途。在指定后端阶段前转储状态。原文:Dump the backend's state before these phases.

影响。主要改变诊断/日志输出;对产物行为影响通常很小。

适用场景。编译器/后端排查或信息查询;定位完成后关闭冗余输出。

取值说明

列表 · 写法 -Xphases-to-dump-before <value> · 默认 null / 未设置

  • 参数描述:Dump the backend's state before these phases.

可写。<value> (可重复/数组型参数。valueDescription=(无))

定义依据:description/CommonCompilerArguments.kt 在仓库中打开

怎么用

  1. 配置入口:build.gradle.kts → ohosArm64.binaries.all { freeCompilerArgs += "-Xphases-to-dump-before" }
  2. 示例
// 文件:build.gradle.kts(应用的 Kotlin 模块,例如 composeApp)
kotlin {
  ohosArm64 {  // 按实际 native target 调整
    binaries.all {
      freeCompilerArgs += "-Xphases-to-dump-before"
    }
  }
}
  1. 生效:Sync 后执行该目标的 compile/link。
  2. 验证:确认输出中出现预期诊断内容(不仅是命令行出现 `-Xphases-to-dump-before`)。
  3. 回滚:从 binaries.all 的 freeCompilerArgs 中删除该项后 Clean 并重编。
  4. 注意:会显著增加日志或中断流水线;定位完及时去掉。

默认行为 未设置

不写这个配置时,编译器会怎么处理?

此选项默认未设置(空列表 / 空映射 / null)。不设置时由其他逻辑决定行为或直接跳过。

未指定则为空。

相关文档

以下摘抄原文中与本配置最相关的段落,便于速读;完整上下文请点原文。

上游 · Kotlin compiler options · Common

complete : enables short-form name-based destructuring with parentheses and continues supporting position-based destructuring with square bracket syntax.

-Xphases-to-dump-before

Set to ExternalPackageParentPatcherLowering to create a dump file after the IR lowering compilation stage. Configure the output directory for the Kotlin/JVM with the -Xdump-directory compiler option.

-Xrepl

Activates the Kotlin REPL.

打开原文

溯源与对照

状态
实验(-X,兼容性不保证)
版本基线
2.2.21-1.0.0
定义位置类型
编译器参数定义(arguments DSL)
源码路径
compiler/arguments/src/org/jetbrains/kotlin/arguments/description/CommonCompilerArguments.kt 在仓库中打开