[PATCH] D80833: [CodeView] Add full repro to LF_BUILDINFO record

Alexandre Ganea via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 3 10:58:28 PDT 2020


aganea marked an inline comment as done.
aganea added a comment.

I didn't change the PWD/CWD stored in `LF_BUILDINFO`, it has already been done by Reid a while ago: D53179 <https://reviews.llvm.org/D53179> (it already stores absolute paths)

However absolute paths are stored by design, if we want to reproduce the build locally. I can't see how this feature could be useful if we didn't store absolute paths. The user could have many different branches of the same game synced locally (we're using perforce).

We could somehow defer the full path calculation to link-time if we didn't want full paths in the .OBJs. But each `LF_BUILDINFO` in the final .PDB needs to store full local paths.
Please let me know what direction should be taken.

This is what I have now:

  > cat b.cpp
  int f() { return 42; }
  
  # With Microsoft cl.exe (VS2019):
  
  > cl b.cpp /c /Z7
  > llvm-pdbutil dump -all b.obj | grep LF_BUILDINFO -A 5 -B 6
  0x1007 | LF_STRING_ID [size = 248] ID: <no type>, String: -c -Z7 -MT -I"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.26.28801\ATLMFC\include" -I"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.26.28801\include" -I"C:\Program
  0x1008 | LF_STRING_ID [size = 268] ID: <no type>, String:  Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um"
  0x1009 | LF_SUBSTR_LIST [size = 16]
           0x1007: `-c -Z7 -MT -I"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.26.28801\ATLMFC\include" -I"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.26.28801\include" -I"C:\Program`
           0x1008: ` Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um"`
  0x100A | LF_STRING_ID [size = 160] ID: 0x1009, String:  -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" -TP -X
  0x100B | LF_BUILDINFO [size = 28]
           0x1003: `D:\llvm-project`
           0x1004: `C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.26.28801\bin\HostX64\x64\cl.exe`
           0x1005: `b.cpp`
           0x1006: `D:\llvm-project\vc140.pdb`
           0x100A: ` -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" -I"C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" -TP -X`
  
  # With Clang:
  
  > clang-cl b.cpp /c /Z7
  > llvm-pdbutil dump -all b.obj | grep LF_BUILDINFO -A 5
  0x1007 | LF_BUILDINFO [size = 28]
           0x1003: `D:\llvm-project`
           0x1005: `D:\llvm-project\buildninjaDebMSVC\bin\clang-cl.exe`
           0x1004: `b.cpp`
           <no type>: ``
           0x1006: `-cc1 -triple x86_64-pc-windows-msvc19.26.28806 -emit-obj -mrelax-all -mincremental-linker-compatible -disable-free -main-file-name -mrelocation-model pic -pic-level 2 -mthread-model posix -mframe-pointer=none -relaxed-aliasing -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -mllvm -x86-asm-syntax=intel -D_MT -flto-visibility-public-std --dependent-lib=libcmt --dependent-lib=oldnames -stack-protector 2 -fms-volatile -fdiagnostics-format msvc -gcodeview -debug-info-kind=limited -resource-dir "D:\llvm-project\buildninjaDebMSVC\lib\clang\11.0.0" -internal-isystem "D:\llvm-project\buildninjaDebMSVC\lib\clang\11.0.0\include" -internal-isystem "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.26.28801\ATLMFC\include" -internal-isystem "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.26.28801\include" -internal-isystem "C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" -internal-isystem "C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" -internal-isystem "C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" -internal-isystem "C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" -internal-isystem "C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" -internal-isystem "C:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" -fdeprecated-macro -fdebug-compilation-dir "D:\llvm-project" -ferror-limit 19 -fmessage-length=120 -fno-use-cxa-atexit -fms-extensions -fms-compatibility -fms-compatibility-version=19.26.28806 -std=c++14 -fdelayed-template-parsing -fcolor-diagnostics -faddrsig -o b.obj -x c++ `



================
Comment at: clang/test/CodeGen/debug-info-codeview-buildinfo.c:8
+// CHECK: ============================================================
+// CHECK: 0x[[PWD:.+]] | LF_STRING_ID [size = {{.+}}] ID: <no type>, String: [[PWDVAL:.+]]
+// CHECK: 0x[[FILEPATH:.+]] | LF_STRING_ID [size = {{.+}}] ID: <no type>, String: [[FILEPATHVAL:.+[\\/]debug-info-codeview-buildinfo.c]]
----------------
amccarth wrote:
> PWD?  Did you mean CWD (current working directory)?
I meant the current working directory when the program starts. I was under the impression that the nomenclature for that is PWD = CWD at startup. While CWD is the current directory at any point in time during the execution, and can be different of PWD.
Would you prefer if I changed the regex capture name to CWD?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80833/new/

https://reviews.llvm.org/D80833





More information about the cfe-commits mailing list