Page MenuHomeFreeBSD

Optionally create full debuginfo for llvm-related executables
ClosedPublic

Authored by dim on Feb 11 2024, 7:03 PM.
Tags
None
Referenced Files
F102071318: D43839.diff
Thu, Nov 7, 6:32 AM
Unknown Object (File)
Tue, Nov 5, 3:13 PM
Unknown Object (File)
Fri, Oct 18, 10:17 AM
Unknown Object (File)
Fri, Oct 18, 10:14 AM
Unknown Object (File)
Thu, Oct 17, 9:24 AM
Unknown Object (File)
Wed, Oct 16, 12:11 PM
Unknown Object (File)
Wed, Oct 16, 4:03 AM
Unknown Object (File)
Tue, Oct 15, 1:54 PM
Subscribers

Details

Summary

Commit de6feefdb7cfd limited the amount of debuginfo generated for clang
and other llvm-related executables. This was done to save disk space and
memory during building, but it makes debugging any of these executables
much harder.

Add a new src.conf(5) setting, WITH_LLVM_FULL_DEBUGINFO, to generate
full debuginfo instead. This is off by default, but could for example be
enabled for release builds or snapshots, so llvm executables are easier
to debug.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 55944
Build 52833: arc lint + arc unit

Event Timeline

dim requested review of this revision.Feb 11 2024, 7:03 PM

The original motivation was definitely that the debug info was very large. I think it was larger than all of the rest of /usr/lib/debug combined at the time. Do you have some before/after numbers now?

Hmm... I did a test run on universe15a with MK_LLVM_LIMIT_DEBUGINFO=yes and MK_LLVM_LIMIT_DEBUG_INFO=no:

$ du -hs ~/obj/limit-*
 18G    /home/dim/obj/limit-no
5.3G    /home/dim/obj/limit-yes

and both clang and lldb have significantly larger debug info:

-rwxr-xr-x  1 dim devel  138M Feb 15 16:28 /home/dim/obj/limit-no/dim/src/freebsd/src/amd64.amd64/usr.bin/clang/clang/clang
-rwxr-xr-x  1 dim devel  1.1G Feb 15 16:28 /home/dim/obj/limit-no/dim/src/freebsd/src/amd64.amd64/usr.bin/clang/clang/clang.debug
-rwxr-xr-x  1 dim devel  138M Feb 15 15:21 /home/dim/obj/limit-yes/dim/src/freebsd/src/amd64.amd64/usr.bin/clang/clang/clang
-rwxr-xr-x  1 dim devel  370M Feb 15 15:21 /home/dim/obj/limit-yes/dim/src/freebsd/src/amd64.amd64/usr.bin/clang/clang/clang.debug
-rwxr-xr-x  1 dim devel  122M Feb 15 16:28 /home/dim/obj/limit-no/dim/src/freebsd/src/amd64.amd64/usr.bin/clang/lldb/lldb
-rwxr-xr-x  1 dim devel  1.1G Feb 15 16:28 /home/dim/obj/limit-no/dim/src/freebsd/src/amd64.amd64/usr.bin/clang/lldb/lldb.debug
-rwxr-xr-x  1 dim devel  122M Feb 15 15:21 /home/dim/obj/limit-yes/dim/src/freebsd/src/amd64.amd64/usr.bin/clang/lldb/lldb
-rwxr-xr-x  1 dim devel  353M Feb 15 15:21 /home/dim/obj/limit-yes/dim/src/freebsd/src/amd64.amd64/usr.bin/clang/lldb/lldb.debug

For other utilities the difference is less extreme:

-rwxr-xr-x  1 dim devel   79M Feb 15 16:28 /home/dim/obj/limit-no/dim/src/freebsd/src/amd64.amd64/usr.bin/clang/lld/ld.lld
-rwxr-xr-x  1 dim devel  555M Feb 15 16:28 /home/dim/obj/limit-no/dim/src/freebsd/src/amd64.amd64/usr.bin/clang/lld/ld.lld.debug
-rwxr-xr-x  1 dim devel   79M Feb 15 15:22 /home/dim/obj/limit-yes/dim/src/freebsd/src/amd64.amd64/usr.bin/clang/lld/ld.lld
-rwxr-xr-x  1 dim devel  191M Feb 15 15:22 /home/dim/obj/limit-yes/dim/src/freebsd/src/amd64.amd64/usr.bin/clang/lld/ld.lld.debug
-rwxr-xr-x  1 dim devel   19M Feb 15 16:27 /home/dim/obj/limit-no/dim/src/freebsd/src/amd64.amd64/usr.bin/clang/llvm-objdump/llvm-objdump
-rwxr-xr-x  1 dim devel   74M Feb 15 16:27 /home/dim/obj/limit-no/dim/src/freebsd/src/amd64.amd64/usr.bin/clang/llvm-objdump/llvm-objdump.debug
-rwxr-xr-x  1 dim devel   19M Feb 15 15:21 /home/dim/obj/limit-yes/dim/src/freebsd/src/amd64.amd64/usr.bin/clang/llvm-objdump/llvm-objdump
-rwxr-xr-x  1 dim devel   34M Feb 15 15:21 /home/dim/obj/limit-yes/dim/src/freebsd/src/amd64.amd64/usr.bin/clang/llvm-objdump/llvm-objdump.debug
-rwxr-xr-x  1 dim devel   17M Feb 15 16:26 /home/dim/obj/limit-no/dim/src/freebsd/src/amd64.amd64/usr.bin/clang/llvm-ar/llvm-ar
-rwxr-xr-x  1 dim devel   66M Feb 15 16:26 /home/dim/obj/limit-no/dim/src/freebsd/src/amd64.amd64/usr.bin/clang/llvm-ar/llvm-ar.debug
-rwxr-xr-x  1 dim devel   17M Feb 15 15:20 /home/dim/obj/limit-yes/dim/src/freebsd/src/amd64.amd64/usr.bin/clang/llvm-ar/llvm-ar
-rwxr-xr-x  1 dim devel   30M Feb 15 15:20 /home/dim/obj/limit-yes/dim/src/freebsd/src/amd64.amd64/usr.bin/clang/llvm-ar/llvm-ar.debug

I guess if this is enabled by default, there will be some complaints about bloat... :)

Maybe I should start with putting LLVM_LIMIT_DEBUGINFO in __DEFAULT_YES_OPTIONS for now? Then it would not influence most people's builds at all, but it is an easy option for those that do like full debuginfo?

In D43839#1001891, @dim wrote:

Maybe I should start with putting LLVM_LIMIT_DEBUGINFO in __DEFAULT_YES_OPTIONS for now? Then it would not influence most people's builds at all, but it is an easy option for those that do like full debuginfo?

That seems reasonable.

Rename option to WITH_LLVM_FULL_DEBUGINFO, off by default.

dim retitled this revision from Stop limiting debuginfo for clang and other llvm-related executables to Optionally create full debuginfo for llvm-related executables.Feb 16 2024, 6:34 PM
dim edited the summary of this revision. (Show Details)
This revision is now accepted and ready to land.Feb 16 2024, 6:40 PM