| author | |
| committer | |
| log | a1aa55ebe52636f28335fd7ab30321fc52f48775 |
| tree | ffcd11295f9865acc27e0b7f1572318885ed0260 |
| parent | 0e394cf922fc84e45e70c0b4a183c9c8b8f079fb |
The issue with just passing `-gcodeview` is that it's not part of
the `OPT_g_Group` in `clang/Driver/Options.td`, so it doesn't trigger
debug info to be generated.
Passing only `-g` is sufficient on MSVC, as there is logic in `Clang.cpp`
which enables codeview if that is the default for the toolchain. Since
the default for -gnu is not codeview, we do pass `-gcodeview` in that case.1 files changed, 5 insertions(+), 1 deletions(-)
src/Compilation.zig+5-1| ... | ... | @@ -4483,7 +4483,11 @@ pub fn addCCArgs( |
| 4483 | 4483 | |
| 4484 | 4484 | if (!comp.bin_file.options.strip) { |
| 4485 | 4485 | switch (target.ofmt) { |
| 4486 | .coff => try argv.append("-gcodeview"), | |
| 4486 | .coff => { | |
| 4487 | // -g is required here because -gcodeview doesn't trigger debug info | |
| 4488 | // generation, it only changes the type of information generated. | |
| 4489 | try argv.appendSlice(&.{ "-g", "-gcodeview" }); | |
| 4490 | }, | |
| 4487 | 4491 | .elf, .macho => try argv.append("-gdwarf-4"), |
| 4488 | 4492 | else => try argv.append("-g"), |
| 4489 | 4493 | } |