Tobias Hieta via llvm-dev
2021-Mar-09 08:37 UTC
[llvm-dev] Debug information with clang-cl on Windows
Hello, We recently switched our windows builds from the CL compiler to clang-cl. This was a pretty big jump in terms of code generation and having a uniform compiler across all the major platforms. Our setup is that our Windows developer use MSVC as the IDE and compile with our own build of clang-cl and link with lld-link. Some of the developers noticed that some of the debug information are not as good as with CL. Or rather some variables seems to be optimized out, this is what the IDE says, see attached screenshot. I have tried to figure out if there is a rhyme and reason to what variables are gone - but I have not been able to see any pattern. Our command line is: clang-cl.exe /nologo -DUNICODE -DUSE_BREAKPAD -DWIN32 -DWIN32_LEAN_AND_MEAN -DWINVER=0x0601 -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_LEGACY_NAT_TRAVERSAL_ -D_REENTRANT -D_SCL_SECURE_NO_WARNINGS -D_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS -D_UNICODE -D_WIN32_WINNT=0x0601 -D_WINSOCK_DEPRECATED_NO_WARNINGS -Iincludes -m32 -fdiagnostics-absolute-paths --target=i686-windows-msvc -m32 /DWIN32 /D_WINDOWS /GR /EHsc /Zi /Ob0 /Od /RTC1 -MDd /Zm512 /EHsc /bigobj /W3 -Werror -Wsign-compare -Wno-reorder-ctor -Wno-delete-non-virtual-dtor -Wunused-variable -Wuninitialized -std:c++14 Is there any good way to debug this or is it a known limitation with clang-cl or 32 bit (we don't do 64 yet - but with clang-cl we hope to move towards that soon). Or am I missing some flags? Thanks, Tobias -------------- next part -------------- A non-text attachment was scrubbed... Name: 108345285-bf402180-71e6-11eb-9090-29f6ebb8423e.png Type: image/png Size: 27244 bytes Desc: not available URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210309/50384b93/attachment.png>
Tobias Hieta via llvm-dev
2021-Mar-09 08:54 UTC
[llvm-dev] Debug information with clang-cl on Windows
I forgot a pretty important piece of information, we are currently on LLVM 11.0.1. On Tue, Mar 9, 2021 at 9:37 AM Tobias Hieta <tobias at plexapp.com> wrote:> > Hello, > > We recently switched our windows builds from the CL compiler to > clang-cl. This was a pretty big jump in terms of code generation and > having a uniform compiler across all the major platforms. > > Our setup is that our Windows developer use MSVC as the IDE and > compile with our own build of clang-cl and link with lld-link. > > Some of the developers noticed that some of the debug information are > not as good as with CL. Or rather some variables seems to be optimized > out, this is what the IDE says, see attached screenshot. I have tried > to figure out if there is a rhyme and reason to what variables are > gone - but I have not been able to see any pattern. > > Our command line is: > > clang-cl.exe /nologo -DUNICODE -DUSE_BREAKPAD -DWIN32 > -DWIN32_LEAN_AND_MEAN -DWINVER=0x0601 -D_CRT_NONSTDC_NO_DEPRECATE > -D_CRT_SECURE_NO_WARNINGS -D_LEGACY_NAT_TRAVERSAL_ -D_REENTRANT > -D_SCL_SECURE_NO_WARNINGS -D_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS > -D_UNICODE -D_WIN32_WINNT=0x0601 -D_WINSOCK_DEPRECATED_NO_WARNINGS > -Iincludes -m32 -fdiagnostics-absolute-paths > --target=i686-windows-msvc -m32 /DWIN32 /D_WINDOWS /GR /EHsc /Zi /Ob0 > /Od /RTC1 -MDd /Zm512 /EHsc /bigobj /W3 -Werror -Wsign-compare > -Wno-reorder-ctor -Wno-delete-non-virtual-dtor -Wunused-variable > -Wuninitialized -std:c++14 > > Is there any good way to debug this or is it a known limitation with > clang-cl or 32 bit (we don't do 64 yet - but with clang-cl we hope to > move towards that soon). Or am I missing some flags? > > Thanks, > Tobias
David Blaikie via llvm-dev
2021-Mar-09 22:46 UTC
[llvm-dev] Debug information with clang-cl on Windows
I would guess there's no one bug here - debug info quality (specifically/especially the location of variables when compiling with optimizations enabled) is a long tail/sliding scale of issues. LLVM is, on the whole, not spectacular at this - a matter of bugs to fix, some small/simple, others more systemic/representational. If you're interested in contributing to this work - generally the first step is to isolate the problem - first thing you can do is if you have some experience dumping/examining debug info in object files, you can dump/examine the relevant object files then try to reduce/remove code from the relevant objects, etc, to see what the minimal example is that'll make it easier to figure out how to fix. On Tue, Mar 9, 2021 at 12:37 AM Tobias Hieta via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Hello, > > We recently switched our windows builds from the CL compiler to > clang-cl. This was a pretty big jump in terms of code generation and > having a uniform compiler across all the major platforms. > > Our setup is that our Windows developer use MSVC as the IDE and > compile with our own build of clang-cl and link with lld-link. > > Some of the developers noticed that some of the debug information are > not as good as with CL. Or rather some variables seems to be optimized > out, this is what the IDE says, see attached screenshot. I have tried > to figure out if there is a rhyme and reason to what variables are > gone - but I have not been able to see any pattern. > > Our command line is: > > clang-cl.exe /nologo -DUNICODE -DUSE_BREAKPAD -DWIN32 > -DWIN32_LEAN_AND_MEAN -DWINVER=0x0601 -D_CRT_NONSTDC_NO_DEPRECATE > -D_CRT_SECURE_NO_WARNINGS -D_LEGACY_NAT_TRAVERSAL_ -D_REENTRANT > -D_SCL_SECURE_NO_WARNINGS -D_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS > -D_UNICODE -D_WIN32_WINNT=0x0601 -D_WINSOCK_DEPRECATED_NO_WARNINGS > -Iincludes -m32 -fdiagnostics-absolute-paths > --target=i686-windows-msvc -m32 /DWIN32 /D_WINDOWS /GR /EHsc /Zi /Ob0 > /Od /RTC1 -MDd /Zm512 /EHsc /bigobj /W3 -Werror -Wsign-compare > -Wno-reorder-ctor -Wno-delete-non-virtual-dtor -Wunused-variable > -Wuninitialized -std:c++14 > > Is there any good way to debug this or is it a known limitation with > clang-cl or 32 bit (we don't do 64 yet - but with clang-cl we hope to > move towards that soon). Or am I missing some flags? > > Thanks, > Tobias > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210309/1a411b44/attachment.html>
Reid Kleckner via llvm-dev
2021-Mar-10 20:38 UTC
[llvm-dev] Debug information with clang-cl on Windows
I'm glad to hear things are working reasonably well for you. :) Regarding variables marked as optimized out, the main issue that I'm aware of has to do with parameters at function entry. We had a user report this as https://crbug.com/755841. What you have in the screenshot doesn't seem related to parameters. It seems like this issue could be specific to 32-bit x86. We can definitely take a look at a more detailed bug report if you find the time to file one, but as Adrian mentioned, 64-bit is becoming the better tested, more robust, target. Reid On Tue, Mar 9, 2021 at 12:37 AM Tobias Hieta via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Hello, > > We recently switched our windows builds from the CL compiler to > clang-cl. This was a pretty big jump in terms of code generation and > having a uniform compiler across all the major platforms. > > Our setup is that our Windows developer use MSVC as the IDE and > compile with our own build of clang-cl and link with lld-link. > > Some of the developers noticed that some of the debug information are > not as good as with CL. Or rather some variables seems to be optimized > out, this is what the IDE says, see attached screenshot. I have tried > to figure out if there is a rhyme and reason to what variables are > gone - but I have not been able to see any pattern. > > Our command line is: > > clang-cl.exe /nologo -DUNICODE -DUSE_BREAKPAD -DWIN32 > -DWIN32_LEAN_AND_MEAN -DWINVER=0x0601 -D_CRT_NONSTDC_NO_DEPRECATE > -D_CRT_SECURE_NO_WARNINGS -D_LEGACY_NAT_TRAVERSAL_ -D_REENTRANT > -D_SCL_SECURE_NO_WARNINGS -D_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS > -D_UNICODE -D_WIN32_WINNT=0x0601 -D_WINSOCK_DEPRECATED_NO_WARNINGS > -Iincludes -m32 -fdiagnostics-absolute-paths > --target=i686-windows-msvc -m32 /DWIN32 /D_WINDOWS /GR /EHsc /Zi /Ob0 > /Od /RTC1 -MDd /Zm512 /EHsc /bigobj /W3 -Werror -Wsign-compare > -Wno-reorder-ctor -Wno-delete-non-virtual-dtor -Wunused-variable > -Wuninitialized -std:c++14 > > Is there any good way to debug this or is it a known limitation with > clang-cl or 32 bit (we don't do 64 yet - but with clang-cl we hope to > move towards that soon). Or am I missing some flags? > > Thanks, > Tobias > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210310/61f49270/attachment.html>