Closed optimizedaway closed 5 years ago
Ah, so it is still there after all. Yeah, I did that previously (it's still in the commit log somewhere), but removed it since that information did no longer exist in the PDBs of projects I compiled with Visual C++ 2017 and thus I had though Microsoft removed it. But it could be that you need to enable the "Edit & Continue" PDB format for that information to appear in the PDB.
I'm on "Edit & Continue" PDB (/ZI) and cannot find any compilation command neither with hexviewer nor with cvdump. There is only a linker command present.
Nevermind, I misread your post. You were talking about the OBJ file, not PDB. That's less usefull though, since there is no way to obtain this information from the application? Unless paths to the OBJ files are stored in the PDB, but if I recall correctly that is not the case.
OBJ files are listed in the PDB as modules.
Microsoft (R) Debugging Information Dumper Version 14.00.23611
Copyright (C) Microsoft Corporation. All rights reserved.
*** IDs
*** MODULES
0001 "D:\Devel\pbr\build\Hot.x64\pbr\pbr.res"
0002 "D:\Devel\pbr\build\Hot.x64\pbr\tangent.obj"
0003 "D:\Devel\pbr\build\Hot.x64\pbr\mikktspace.obj"
0004 "D:\Devel\pbr\build\Hot.x64\pbr\import_obj.obj"
0005 "D:\Devel\pbr\build\Hot.x64\pbr\import.obj"
0006 "D:\Devel\pbr\build\Hot.x64\pbr\gui.obj"
0007 "D:\Devel\pbr\build\Hot.x64\pbr\tick.obj"
0008 "D:\Devel\pbr\build\Hot.x64\pbr\input_win.obj"
0009 "D:\Devel\pbr\build\Hot.x64\pbr\input.obj"
000A "D:\Devel\pbr\build\Hot.x64\pbr\states11.obj"
000B "D:\Devel\pbr\build\Hot.x64\pbr\scene11.obj"
000C "D:\Devel\pbr\build\Hot.x64\pbr\render11.obj"
000D "D:\Devel\pbr\build\Hot.x64\pbr\import11.obj"
000E "D:\Devel\pbr\build\Hot.x64\pbr\device11.obj"
000F "D:\Devel\pbr\build\Hot.x64\pbr\transform.obj"
0010 "D:\Devel\pbr\build\Hot.x64\pbr\log.obj"
0011 "D:\Devel\pbr\build\Hot.x64\pbr\hresult.obj"
0012 "D:\Devel\pbr\build\Hot.x64\pbr\file.obj"
0013 "D:\Devel\pbr\build\Hot.x64\pbr\allocator.obj"
0014 "D:\Devel\pbr\build\Hot.x64\pbr\main.obj"
0015 "D:\Devel\pbr\build\Hot.x64\pbr\imgui_widgets.obj"
0016 "D:\Devel\pbr\build\Hot.x64\pbr\imgui_draw.obj"
0017 "D:\Devel\pbr\build\Hot.x64\pbr\imgui.obj"
0018 "C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\um\x64\d3d11.lib" "Import:d3d11.dll"
0019 "C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\um\x64\d3d11.lib" "d3d11.dll"
001A "C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\um\x64\dxgi.lib" "Import:dxgi.dll"
001B "C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\um\x64\dxgi.lib" "dxgi.dll"
001C "C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\um\x64\dxguid.lib" "d:\os\obj\amd64fre\onecoreuap\windows\directx\misc\dxguid\daytona\objfre\amd64\d3d10guid.obj"
001D "C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\um\x64\ws2_32.lib" "Import:WS2_32.dll"
001E "C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\um\x64\ws2_32.lib" "WS2_32.dll"
001F "C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\um\x64\kernel32.lib" "Import:KERNEL32.dll"
0020 "C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\um\x64\kernel32.lib" "KERNEL32.dll"
0021 "C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\um\x64\user32.lib" "Import:USER32.dll"
0022 "C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\um\x64\user32.lib" "USER32.dll"
0023 "C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\um\x64\imm32.lib" "Import:IMM32.dll"
0024 "C:\Program Files (x86)\Windows Kits\10\lib\10.0.17763.0\um\x64\imm32.lib" "IMM32.dll"
…
List of compilands (OBJ files) can be obtained with DIA https://gist.github.com/optimizedaway/5a2c2b5a9284e6a2e55ff0dd1badf083
Nice! Well in that case, this is doable. I want to avoid dependencies and DIA, but can extend the PDB parser to read that information easily (it's in the DBI stream, right after the DBI header). https://github.com/crosire/blink/blob/2ced27abd536dcae884413a321f9ced072c27ffb/source/pdb_reader.cpp#L217
Great! avoid DIA if you can, although with NoRegCoCreate at least you avoid COM hell. I'm available should you need any help.
This works now =)
First of all, Thank you fo blink. It is amazing :)
As you already know, blink is not able to extract the compilation command when compiling with /Z7. (in that case compilation command is not stored in .debug$S section). I use fastbuild (https://github.com/fastbuild/fastbuild ) and distributed compilation is problematic without Z7. After investigating the contents of an OBJ file compiled with Z7 I noticed that compilation command seems to be stored in .debug$T instead of .debug$S...
I believe full compilation command is stored in on of .debug$S sections of obj file.
Excerpt from the dump:
This command could be used to recompile modified source files. Right now compilation command has to be hardcoded in the blink.exe.