Enabling debug information for debug only

Hello!

I would like to debug Clang but avoid having to build LLVM with debug symbols
enabled due to the size of the debug build which causes problems on the target
system where I want to debug due to disk constraints.

Is it possible to build LLVM and Clang but enable debug symbols for Clang only?

If yes, how?

Adrian

PS: I'm only receiving digests on this list, so please keep me CC'ed.

Hi John,

This should help: http://lists.llvm.org/pipermail/llvm-dev/2019-August/134606.html

Best,
Alexey

Hi Alexey!

Another solution is to build the entire program with debug info, then write a small shell sscript which crawls your tree using objcopy or something to strip out the debug symbols, then re-run your build step. It should see the object files as not being out of date since they are newer than the source files, but the final executable being out of date since the object files are newer than the executable. So it should simply re-link with debug info stripped out of whichever files you ran objcopy on. This has the nice property that you don’t have to make local changes to cmake, and you can keep this script somewhere in your local repository.