Now I want to read the clang source code, but I can’t find the main function where clang begin to run. So I am ready to debug the clang using gdb or lldb, I don’t know how to do it? Is there anyone who can help me? Thinks a lot.
Have a look at clang/tools/driver/driver.cpp
Unless you’d like to debug the driver itself you’ll need to run clang with -cc1 and put a breakpoint in cc1_main.
When I need to do this, I typically run `clang -v myfile.c`, then grab
the clang -cc1 command-line that is printed, and pass that to the