Debugger not functioning correctly when using Clang/Clang++ toolchain


Hi, I am trying to use CLion with an LLVM toolchain. I installed LLVM 14.0.0 from the prebuilt binary releases they offer on GitHub and I have created a new toolchain in CLion that uses the Clang and Clang++ and the bundled LLDB debugger and CMake binary. I tried building a simple Hello World project to test it worked and the two issues I came up with are:

  • The output from std:cout is not being passed to the output console
  • Any breakpoints I set in the code are ignored and the code is just executed without outputting anything.

The sanity checks I did before making this post are:

  • Restarting the IDE
  • Trying another version of LLVM (14.0.1)
  • Trying the most up to date version of CMake available from Kitware
  • Ensuring that CLion was fully up to date
  • Using the bundled GBD debugger
  • Using the LLDB debugger that came with the LLVM toolchain I installed (this just caused an error)
  • Checking the CMake variables to ensure that the debugging information was actually being produced

At this point I am all out of ideas and I don't know what I am doing wrong to fix it. I would swap to the integrated MinGW toolchain, but the project I am working on necessitates the LLVM toolchain



As far as we know, LLVM Clang for Windows is built using Microsoft Visual Studio. So it's better to use it with the MSVC toolchain -


So just to confirm after reading that webpage, you have support for the standard Clang driver via MinGW using their pipeline or the Clang-CL driver for the visual studio toolset. But you don't have support for using the native clang driver that functions on Windows? I until this point had just been using a "system" toolchain pointed directly to where the LLVM tools were installed and it builds just fine it's just the debugger that doesn't seem to work. 


What do you mean by the "native clang driver"? As far as I understand, you installed LLVM on Windows. The LLVM Clang for Windows is built using Microsoft Visual Studio.


I did install LLVM on Windows. But if you use a Visual Studio toolchain in CLion and tell it to use Clang it will try to use the clang-cl.exe executable as the compiler. I would like it to use to Clang.exe executable as a compiler as this takes Unix style command line arguments as opposed to clang-cl.exe which takes MSVC style command line arguments. I know that code can be compiled and linked  by using the clang.exe executable and debugged using lldb because I have done it before in VSCode. I simply want to replicate the same compiling and linking tools now that I am using CLion but the debugger doesn't work when compiled that way


>but the debugger doesn't work when compiled that way

The thing is that the bundled LLDB on Windows was implemented by us specifically for the MSVC toolchain -

And using a custom LLDB is not supported in CLion yet -

It seems using MinGW+Clang compiler for MinGW+GDB is the only option you can try using in CLion now.


Ah, I see. I have to say it's a bit disappointing that it's not currently possible to use a custom LLDB but I see where the problem is now. Hopefully support for this will come soon as Clion is a great product from what I have used so far and I would really like to be able to use it fully for this project


I will be certain to do that. Thanks


Please sign in to leave a comment.