Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 29 additions & 15 deletions utils/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ param

# Debug Information
[switch] $DebugInfo,
[ValidateSet("codeview", "dwarf")]
[ValidateSet("codeview", "dwarf", "dwarf-fission")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should call it split-dwarf for consistency. That said, is there any reason to not just make this the default and drop the non-split variant? It seems to be impractical anyway...

Copy link
Member Author

@compnerd compnerd Aug 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default is codeview and we want to keep that I think. The windows tooling prefers codeview (to the point that DWARF basically means that debugging is limited to LLDB, and the QoI there is relatively low). However, if we make dwarf and dwarf-fission synonymous, then I think that we can leave the name as is - once everything is well tested, we can switch dwarf to the dwarf-fission behaviour.

Copy link
Contributor

@Michael137 Michael137 Aug 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just remove DWARF from the get-go? If it's not a useful configuration anyway, it'd be nice to replace it ASAP, rather than live with 3 configurations (which will most likely happen if we don't do it from the start)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None of the debug options are particularly helpful ;) they all have different drawbacks. It's better to have a dozen options that you can select between to resolve the issue than to have no debugging at all.

[string] $CDebugFormat = "dwarf",
[ValidateSet("codeview", "dwarf")]
[string] $SwiftDebugFormat = "dwarf",
Expand Down Expand Up @@ -1421,10 +1421,16 @@ function Build-CMakeProject {
Add-KeyValueIfNew $Defines CMAKE_ASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDLL "/MD"

if ($DebugInfo) {
$ASMDebugFlags = if ($CDebugFormat -eq "dwarf") {
if ($UseGNUDriver) { @("-gdwarf") } else { @("-clang:-gdwarf") }
} else {
if ($UseGNUDriver) { @("-gcodeview") } else { @("-clang:-gcodeview") }
$ASMDebugFlags = switch ($CDebugFormat) {
"dwarf" {
if ($UseGNUDriver) { @("-gdwarf") } else { @("-clang:-gdwarf") }
}
"dwarf-fission" {
if ($UseGNUDriver) { @("-g", "-gsplit-dwarf") } else { @("-clang:-g", "-clang:-gsplit-dwarf") }
}
default {
if ($UseGNUDriver) { @("-gcodeview") } else { @("-clang:-gcodeview") }
}
}

# CMake does not set a default value for the ASM compiler debug
Expand Down Expand Up @@ -1472,11 +1478,15 @@ function Build-CMakeProject {

if ($DebugInfo) {
if ($UsePinnedCompilers.Contains("C") -or $UseBuiltCompilers.Contains("C")) {
if ($CDebugFormat -eq "dwarf") {
$CFLAGS += if ($UseGNUDriver) {
@("-gdwarf")
} else {
@("-clang:-gdwarf")
$CFLAGS += switch ($CDebugFormat) {
"dwarf" {
if ($UseGNUDriver) { @("-gdwarf") } else { @("-clang:-gdwarf") }
}
"dwarf-fission" {
if ($UseGNUDriver) { @("-g", "-gsplit-dwarf") } else { @("-clang:-g", "-clang:-gsplit-dwarf") }
}
default {
if ($UseGNUDriver) { @("-gcodeview") } else { @("-clang:-gcodeview") }
}
}
}
Expand Down Expand Up @@ -1512,11 +1522,15 @@ function Build-CMakeProject {

if ($DebugInfo) {
if ($UsePinnedCompilers.Contains("CXX") -or $UseBuiltCompilers.Contains("CXX")) {
if ($CDebugFormat -eq "dwarf") {
$CXXFLAGS += if ($UseGNUDriver) {
@("-gdwarf")
} else {
@("-clang:-gdwarf")
$CXXFLAGS += switch ($CDebugFormat) {
"dwarf" {
if ($UseGNUDriver) { @("-gdwarf") } else { @("-clang:-gdwarf") }
}
"dwarf-fission" {
if ($UseGNUDriver) { @("-g", "-gsplit-dwarf") } else { @("-clang:-g", "-clang:-gsplit-dwarf") }
}
default {
if ($UseGNUDriver) { @("-gcodeview") } else { @("-clang:-gcodeview") }
}
}
}
Expand Down