ispc / ispc

Intel® Implicit SPMD Program Compiler
BSD 3-Clause "New" or "Revised" License
2.52k stars 315 forks source link

Investigate outputting the PDB debugging format for Windows targets. #2322

Open pbrubaker opened 2 years ago

pbrubaker commented 2 years ago

LLVM added support for the PDB format back in 2017, and it has improved much since then. Other front end teams (such as Unity Burst Compiler) have been using it to great success for a number of years. I think this could improve the debugging experience with Visual Studio and vscode with MSVC tools.

http://blog.llvm.org/2017/08/llvm-on-windows-now-supports-pdb-debug.html

nurmukhametov commented 1 year ago

As I see in my experiments, ISPC has no problem with emitting PDB. I tested it both with MSVC and Clang on Windows. Both setups generated PDB file for me that were OK to debug application in Visual Studio debugger.

The only issue I encountered was with the following CMake project when building with MSVC compiler:

project(pdb_example ISPC C)
add_executable(example dummy.c ex.ispc)

For Debug configuration, cmake doesn't apply /DEBUG linker flag that results in no PDB file has been generated.

But adding the following line fixes that:

target_link_options(example PRIVATE /DEBUG)
pbrubaker commented 8 months ago

Hey @nurmukhametov has a change been created for the CMake changes?

nurmukhametov commented 8 months ago

Hey @nurmukhametov has a change been created for the CMake changes?

I am not sure I follow what CMake changes you are referring to.

pbrubaker commented 7 months ago

Sorry, it seemed like there might need to be changes made to CMake's built-in support of ISPC. Is that not the case?