Asking about how to debug Clang and LLVM?

Hi, everyone.

I scanned the documents listed in the website of LLVM, however, I can’t find information about how to debug the LLVM and Clang. As is known to all, the “-g” option of GCC can help us to debug a program step by step. In the configure file of LLVM, I can see the “-g -O2” option, but I have no idea about what should I do to set up the debug mode. So I changed all the options to “-g -O2” in order to trace the LLVM step by step. However, my effort didn’t work.

I suppose that the easiest way for us to understand a tool is to debug a program step by step so that we can see how it works. Can anyone give some help on this?

To compile Clang and LLVM with debugging symbols, you need to add the ENABLE_OPTIMIZED=0 option to the make command line; this will create what is called a Debug build: make ENABLE_OPTIMIZED=0 All of the object files and tools will be placed in a Debug or Debug+Asserts directory. More documentation on this can be found in the LLVM Getting Started Guide: Regards, John Criswell