Hi,
When the Swift compiler generates the PDB (codeview) files, it currently writes the demangled names (the LF_FUNC_ID
field) for user-defined functions but the mangled names for the compiler-synthesized functions that don’t have source-level names like closures.
We are considering switching some of the compiler-synthesized entities to demangled names to make the backtraces more sensible to the application developers.
For example,
$s7Logging0A6SystemO4lock33_C9FF2A9F0C61C813477A18DFECB0159ALL_WZ
—> one-time initialization function for lock
$s7Logging6LoggerV13MetadataValueO11descriptionSSvgSSAEXEfU_
—> closure #1 (Logger.MetadataValue) -> String in Logger.MetadataValue.description.getter
As we understand it, C++ uses mangled names and the Windows tools rely on UnDecorateSymbolName
to demangle them as needed, while Rust currently demangle all the names in the PDB because the tools don’t understand the Rust demangling.
Do folks have insights as to whether it could potentially cause problems?
For example,
- It would increase the PDB file size (demangled names tend to be larger)
- Some tools such as WPA and WinDBG make assumptions about the names in PDBs such as no whitespaces or special characters, etc.
- Some tools may rely on heuristics of how the names or declarations are to decode additional information (by making assumptions what the associated compilers emit).
Thank you!