I Built Clang from source using Visual Studio in debug mode, and I’m trying to debug it.
However, the debugger doesn’t break on any breakpoint that I put.
When I put breakpoints directly using __debugbreak(), clang just crashes with the even though the debugger is attached.
(I’m sure that this code flow actually happens, as I added some llvm::errs to prove it)
The original Cmake command was:
cmake.exe -DLLVM_ENABLE_PROJECTS=clang -DLLVM_TARGETS_TO_BUILD=X86 -DLLVM_ENABLE_IDE=ON -G “Visual Studio 15 2017” -A x64 -Thost=x64 <path_to_llvm>
Am I doing something wrong?
Is there some other step that I’m missing?
This would be an issue of the Visual Studio debugger, not of the
program you are debugging.
Like this is because when you launch clang, you are launching just the
driver which invokes itself as `clang -cc1` (although under some
conditions it invokes itself directly). Visual Studio does not debug
To see what happens, I suggest to start debugging using "step into"
(or set a breakpoint in main of driver.cpp) and continue from there.
It seems right - the VS debugger doesn’t attach to the new process created by the original one.
clang -cc1 directly works, and is good enough for my purpose.
Thank you very much!
בתאריך יום ג׳, 14 ביולי 2020, 18:43, מאת Michael Kruse <email@example.com>:
Whenever I debug Clang in VS I like to use this plugin to auto attach to all spawned child processes: