gdb supports MiniDebugInfo (.gnu_debugdata) [0][1]. It's a compressed DWARF format which exists within a DWARF section. It uses xz compression. Its main purpose is to retain symtab which gets stripped not just in Gentoo but pretty much everywhere. Having symtab is pretty critical for profiling but also getting some emergency backtrace out of e.g. gdb without rebuilding with debug symbols. Fedora also seems to enable it by default [2]. The gdb page [0] has a nice simple example for how to implement it, too. [0] https://sourceware.org/gdb/current/onlinedocs/gdb.html/MiniDebugInfo.html [1] https://maskray.me/blog/2022-10-30-distribution-of-debug-information#minidebuginfo [2] https://fedoraproject.org/wiki/Features/MiniDebugInfo
The idea here would be that we implement it under some FEATURES flag at first, then do it by default unconditionally (or at least on-by-default). It doesn't have much value if users have to opt-in to it. The overhead is also very low. It's intended to _not_ be a replacement for full debug information.
dev-debug/valgrind doesn't support it, although I don't think that's a blocker for this (filed https://bugs.kde.org/show_bug.cgi?id=492429). dev-debug/dtrace is likely to add support (https://github.com/oracle/dtrace-utils/issues/96).
One decision to make is if we include symtab *and* line number information. The line number information makes it a fair bit bigger although still nothing like DWARF.