[llvm-bugs] [Bug 41615] New: clang-cl: codeview debug info written by clang isn't sufficient for natvis files that reference static members

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Apr 26 07:33:18 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=41615

            Bug ID: 41615
           Summary: clang-cl: codeview debug info written by clang isn't
                    sufficient for natvis files that reference static
                    members
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: nicolasweber at gmx.de
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

C:\src\repro2>type test.cc
struct S {
  static const int kFoo = 18;
  S();
  int a;
};

const int S::kFoo;

S::S() { // Just here so s in main isn't optimized away
  a = 4;
}

int main() {
  S s;
  return S::kFoo + s.a;
}
C:\src\repro2>type test.natvis
<?xml version="1.0" encoding="utf-8" ?>
<AutoVisualizer
  xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
  <Type Name="S">
    <DisplayString>kFoo = {kFoo}</DisplayString>
  </Type>
</AutoVisualizer>


C:\src\repro2>cl test.cc /nologo /Z7 /link /natvis:test.natvis

C:\src\repro2>devenv /debugexe test.exe

Then ctrl-o, open test.cc, add breakpoint on the return line in main by
clicking in left margin, F5 to start debugging. Note that `s` has `kFoo = 18`
in its description.



Now the same with clang-cl (and link.exe, so no lld-link pdb writing):

C:\src\repro2>
"..\chrome\src\third_party\llvm-build\Release+Asserts/bin/clang-cl" test.cc
/nologo /Z7 /link /natvis:test.natvis


And hit F5 in MSVC again. This time, s instead shows up as `{a=4}`, and if you
go to Tools->Options->Debugging->Output Window and change "Natvis diagnostic
messages" (6th from top in msvc2017) to "Warning" the output window contains:

Natvis: test.natvis (from C:\src\repro2\test.pdb)(5,28): Error: identifier
"kFoo" is undefined
    Error while evaluating 'kFoo' in the context of type 'test.exe!S'.


Natvis: test.natvis (from C:\src\repro2\test.pdb)(5,28): Error: identifier
"kFoo" is undefined
    Error while evaluating 'kFoo' in the context of type 'test.exe!S'.



merlynop at ms suggests this might be due to clang-cl not writing a S_CONSTANT
record.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190426/51b85a58/attachment.html>


More information about the llvm-bugs mailing list