- 1 Debug Info Standardization (from DWZ to -fdebug-types-section)
Debug Info Standardization (from DWZ to -fdebug-types-section)
Fedora 18 implemented Features/DwarfCompressor called DWZ. As the format remains specific to Linux distributions it became a burden to make existing debugging tools compatible with DWZ.
- Name: Jan Kratochvil
- Email: email@example.com
This Change does not represent Red Hat's opinion, see #Feedback.
- Targeted release: Fedora 34
- Last updated: 2020-10-12
- FESCo issue: #2482
- Tracker bug: <will be assigned by the Wrangler>
- Release notes tracker: <will be assigned by the Wrangler>
Debug info files *.debug contained in *-debuginfo.rpm are very big in general (x86_64 Fedora 32 distribution has debug/ directory of 82GB while all its other files are only 75GB). There exist several methods how to make the *-debuginfo.rpms at least a bit smaller. Fedora 18 started using DWZ tool (from Features/DwarfCompressor) while Google implemented the same goal in a different way called -fdebug-types-section.
Linux distributions use existing DWZ (Fedora/CentOS/RHEL, SuSE OSes, OpenMandriva, Debian, Ubuntu maybe others?). DWZ support is missing in crossplatform tools like LLDB or llvm-dwarfdump. -fdebug-types-section is used internally by Google (produced by clang).
- DWZ advantage: On the whole Fedora distro it saves 3.3% (5GB of the 157GB distribution size)
- If the 3.3% size increase is a concern I can implement a different optimization as a GCC post-processing phase which would require no changes in any DWARF consumers. DWZ would still makes the Fedora distribution smaller but only by 2.4%.
- With another optimization (reintroducing a common file but a very simple one just containing DW_UT_type units) DWZ still makes the Fedora distribution smaller but only by 1.8%.
- DWZ disadvantage: DWZ has currently less support across consumers (LLDB, llvm-dwarfdump)
- DWZ disadvantage: DWZ requires 8x times more complicated (LoC count) support in consumers than -fdebug-types-section
- DWZ disadvantage: Changes/DebugInfoLldbIndex (LLDB acceleration) is disabled by DWZ; unless DWZ gets excluded from clang-built binaries
- DWZ disadvantage: -fdebug-types-section unifies tools compatibility with format of binaries from rpms vs. binaries from edit-compile-debug cycle. DWZ is an additional time overhead for edit-compile-debug cycle while -fdebug-types-section even speeds up edit-compile-debug cycle (its linking phase).
- DWZ disadvantage: DWZ DWARF-5 support is a work-in-progress. DWZ has been blocking DWARF-5 for Fedora for 3.5 years and only after I have now proposed to drop DWZ Mark Wielaard has started porting DWZ to DWARF-5. It can be expected next DWARF extensions will remain unsupported again. Even currently there is no plan to support DWARF-5 features used by clang which may need -fdebug-types-section for clang-built binaries or no size optimization of clang-built debug info at all.
- DWZ disadvantage: Compilation (linking) requires for C++ up to 2x as big disk space (as DWZ is processing files after linker and DWZ is incompatible with -fdebug-types-section)
- DWZ disadvantage: Compilation (linking) is slower
This proposed DWARF format was originally submitted already for Fedora 18 as Features/DebugTypesSections.
Jakub Jelinek (and at least some people from GCC+GDB Red Hat teams) disagrees with this Change. LLDB/clang/LLVM Red Hat team (incl. me) in general supports this Change.
Benefit to Fedora
- Better compatibility with existing debugging and tracing tools, primarily LLDB.
- Less resource-intensive rebuilds of C++ packages (in disk space, memory requirements and compilation time).
- Proposal owners: It affects all packages generating *-debuginfo.rpm, that is compiled (not scripted) languages.
- Other developers: Report any possible debuginfo incompatibility (unexpected).
- Release engineering: #9769 (a check of an impact with Release Engineering is needed)
- Policies and guidelines: All the needed changes should be done in redhat-rpm-config. The dwz package can be then retired.
- Trademark approval: N/A (not needed for this Change)
- Alignment with Objectives: The size differences are only for *-debuginfo.rpm which is outside of scope of the listed objectives.
As each *-debuginfo.rpm has to exactly match NVRA of its binary package the Fedora change compatibility is not applicable. Existing tools supporting DWZ will still support the DWZ file format in packages which have not been rebuilt.
How To Test
Then one can use rpmbuild to rebuild a package. For mock use -a|--addrepo with modified redhat-rpm-config.rpm (with increased NVRA). For packages already rebuilt in Koji nothing is needed.
Test programs like lldb and gdb if they still can print source code, function parameters, variables etc.
One should also verify integrated testsuites of tools like clang, lldb, gcc, binutils, gdb, elfutils or rpm are not regressing with the -fdebug-types-section option.
One can also compare *.debug files built with/without DWZ and/or -fdebug-types-section using libabigail utility dwdiff but that will be rather done by the change owner.
No user visible change. This affects what tools can developers use.
Mass rebuild is not required. Packages inherited from F-33 will just keep the DWZ format which stays incompatible with some tools but that has been so since Fedora 18.
This change affects/enables: Changes/DebugInfoLldbIndex
- Contingency mechanism: Revert the change in redhat-rpm-config. Fedora can continue using DWZ, just some debugging/tracing tools will stay incompatible.
- Contingency deadline: beta freeze
- Blocks release? No
- Blocks product? N/A