CoreCommands,PackageModel: introduce -debug-format
option
#6659
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds a new flag
-debug-format
that allows some structured control over the debug information format. This is particularly important for Windows where there are two different debugging information formats:While theoretically LLDB supports PDBs, the overall support for that is limited. Furthermore, the CodeView emitted by the swift frontend is limiting for debugging as expression evaluation as not possible due to the debug information encoding employed by Swift: skeletal information is emitted into the binary and the type information is queried dynamically by the AST deserialiser in the compiler.
DWARF on the other hand does not support PE/COFF particularly well (e.g. exceeding the section name limits, representations potentially not being serialisable into the object file, etc), but allows a better experience with LLDB. More importantly, it breaks debugging with the system libraries (e.g. kernel32 or NTDLL). As a result, while it is often used with Swift code, PDBs can also be beneficial. Furthermore, DWARF forces the use of lld as the linker as link does not properly emit linked DWARF information.
Provide a top-level control to emit the debug information in a particular format as both of these options require altering the C/C++, Swift, and linker flags. We default to DWARF on all platforms, but on Windows, if CodeView is selected, we will alter the flags appropriately to ease switching of debug information format.