Debugging LLVM on an IDE

I wish to step through LLVM code in an IDE. My first choice was VScode, but I realized that even with the recent natvis file the variable-watch is crippled due to Microsoft’s current MIEngine limitations (I opened an issue but it didn’t get any attention for 2 months).

Would anyone care to share his/her debugging setup?

Do other IDEs provide better experience?

Maybe there are other (non-natvis) available customizations I’m missing?

I use VSCode on windows, but I don’t need natvis so it works fine for me. Since Visual Studio have native CMake support these days - I bet it can be configured to easily build and debug LLVM - but I haven’t tried this so I can’t give guidance.

1 Like

I use gdb (or lldb since it has better colours in my taste) as console debuggers.

I use a Linux cloud virtual machine to build Clang/LLVM there, because all my laptops are too weak to build it in Debug mode (other modes are just non-debuggable). The virtual machine has 32 CPU cores, 32GB RAM, 200GB SSD for a decent price, and the whole Clang/LLVM is built from scratch in just 13 minutes.

I’m using Vim right inside the virtual machine console, but one can use VScode (from Windows/Linux) to connect to the machine via SSH and remotely debug the code. My colleagues do it at work all the time.

I actually have a small blog post regarding how to obtain a cloud virtual machine and work inside it, with nice screenshots. I can translate it from my mother tongue to English if you want, it won’t cause any inconvenience because I’m anyway translating my whole C++ blog.

1 Like

I use CLion for developing and find the debugger integration there to work really well. I find it works a lot better with LLDB compared to GDB, since GDB seems very slow (even with .gdb_index).

Another thing that makes the debugging experience more pleasant is autoloading the LLVM/Clang data formatters (llvm/utils/ and clang/utils/ I’ve uploaded D141219 to allow them to be autoloaded once you set settings set target.load-cwd-lldbinit true in ~/.lldbinit.

I also have a local patch to add a somewhat hacky data formatter for LLVM’s Type and Value, which I can submit to Phab if there is interest in having that.

1 Like

Thanks, I would be very interested to read an english version if you’d make one.

Thanks! CLion is paid but I think I can get some access to it. Would also love to try out your Type/Value data formatters.

Hi! I have translated my articles some days ago, here is the arictle about thin clients for developing Clang, hope it helps - Thin client for C++ developers (with screenshots!) | C++95

1 Like