Producing DWARF on PE/COFF targets

I’m playing with UEFI and right now the compiler outputs .pdb file for debug symbols which is 0.001% as useful as a punched card deck unless you use Microsoft tooling. LLVM has a way to produce separate DWARF for PE files, but looks like there is no way to trigger it without patching the compiler itself? In general, the build system should have a way to inject LLVM parameters for stuff it’s doesn’t know about, rather than assume “if I don’t need that, then nobody does”.

See this merged pull request: Dwarf on windows

  • Emit Dwarf debug info if targetting gnu abi on windows (maybe this should be a flag instead)
  • Add support for reading Dwarf info from COFF executables for stack and error tracing

Thanks dimdin. But maybe I’m being dumb, but while the pull request says “Emit Dwarf debug info if targetting gnu abi on windows” I can’t see any emit code/LLVM parameter passing, only parsing? And in 0.13.0 debug_info isn’t even used anywere…

I am not sure that this is going to work but I find some kind of support.
Try to search for dwarf debug section in the image even if a pdb file is generated.

For C the flag is: -gdwarf
For Zig the flags are: -gdwarf32 and -gdwarf64
In std.Build.Module there is the dwarf_format member that controls the -gdwarf32 and -gdwarf64 flags.