c[ode]clap » Forums » Expected Date for Windows DWARF Support
SaraPanda
Sara
3 posts
#16983 Expected Date for Windows DWARF Support
1 month ago Edited by Sara on Dec. 18, 2018, 9:28 a.m.

Hi there.
Just wondering if you could give a rough estimate as to when the windows version will support the DWARF format.
I try to avoid microsoft products as much as possible and so prefer to use clang/mingw64 which doesn't support PDB generation.
Thanks.
mmozeiko
Mārtiņš Možeiko
1865 posts / 1 project
#16984 Expected Date for Windows DWARF Support
1 month ago Edited by Mārtiņš Možeiko on Dec. 18, 2018, 10:02 a.m.

Clang supports pdb generation just fine. For example, to use it with lld.exe from mingw-w64-x86_64-lld package (in msys2) do this:

1
clang.exe -fuse-ld=lld.exe -g -gcodeview -Wl,/debug,/pdb:test.pdb -o test.exe test.c


This will create test.pdb next to test.exe which will work in Visual Studio just fine.

If you are using clang binary build from offical website then replace lld.exe with lld-link.exe.
spx
78 posts / 1 project
#16990 Expected Date for Windows DWARF Support
1 month ago Edited by spx on Dec. 18, 2018, 7:24 p.m.

mmozeiko
Clang supports pdb generation just fine. For example, to use it with lld.exe from mingw-w64-x86_64-lld package (in msys2) do this:

1
clang.exe -fuse-ld=lld.exe -g -gcodeview -Wl,/debug,/pdb:test.pdb -o test.exe test.c


This will create test.pdb next to test.exe which will work in Visual Studio just fine.

If you are using clang binary build from offical website then replace lld.exe with lld-link.exe.

nice, thanks for posting the command line. I did quickly try out clang in the past and never got it to emit line information. Seems it works when invoked this way.

SaraPanda
Hi there.
Just wondering if you could give a rough estimate as to when the windows version will support the DWARF format.
I try to avoid microsoft products as much as possible and so prefer to use clang/mingw64 which doesn't support PDB generation.
Thanks.

Sorry I've not set a target version for this. But maybe the suggestion from Martins could be an option for you. I haven't yet tested codeclap with clang generated debug information but that is targeted for 0.9.x.
SaraPanda
Sara
3 posts
#16998 Expected Date for Windows DWARF Support
1 month ago

mmozeiko
Clang supports pdb generation just fine. For example, to use it with lld.exe from mingw-w64-x86_64-lld package (in msys2) do this:

1
clang.exe -fuse-ld=lld.exe -g -gcodeview -Wl,/debug,/pdb:test.pdb -o test.exe test.c


This will create test.pdb next to test.exe which will work in Visual Studio just fine.

If you are using clang binary build from offical website then replace lld.exe with lld-link.exe.


Hi Martins.
Thank you for your command line invocation.
Previously, I had not given any arguments to linker, simply doing:
1
clang.exe -gcodeview test.c -o test.exe

This did not generate a pdb file.
However, your invocation works!
Thanks again!
mmozeiko
Mārtiņš Možeiko
1865 posts / 1 project
#16999 Expected Date for Windows DWARF Support
1 month ago

Yeah, by default clang uses ld.exe which is linker from binutils. And that one knows only dwarf, no codeview format. That's why you should use lld, it is also faster.

Alternative is to use clang-cl.exe. That automatically uses lld-link.exe by default to be compatible with cl.exe, but that will require to use cl.exe style arguments:
1
clang-cl.exe /Fetest.exe /Zi test.c


spx
I did quickly try out clang in the past and never got it to emit line information.

It emits not only line information but full symbol table - for global and local variables. Basically everything to debug even with Visual Studio, everything works - stepping, breakpoints, watching variable values, etc...