== Summary ==
Provide .debug_names debug info index for LLDB for clang-built
binaries using: clang -gdwarf-5 -gpubnames
Debuginfo index significantly accelerates loading of *.debug files by
debugger. Fedora currently provides ELF section .gdb_index for
LLDB debugger] cannot use .gdb_index (as it is
missing DIE offsets for more effective processing by LLDB) but LLDB
can use .debug_names index.
== Owner ==
* Name: [[User:jankratochvil| Jan Kratochvil ]]
* Email: jan.kratochvil(a)redhat.com
== Detailed Description ==
There are currently 3 formats of debug info index:
* .gdb_index: It is currently produced in Fedora by GDB
(/usr/bin/gdb-add-index), it is a part of rpmbuild process. It is
compatible with GDB but incompatible with LLDB as it is missing
essential DIE offsets needed by LLDB due to more effective (faster)
reading of DWARF by LLDB.
* .debug_names from GDB (augmentation "GDB\x00"): It can be produced
by GDB (/usr/bin/gdb-add-index -dwarf-5) but its format is
non-conforming to [http://www.dwarfstd.org/doc/DWARF5.pdf
standard]. LLDB expects DWARF-5 standard compliant .debug_names and
therefore it is incompatible with this format. It can be expected GDB
will fix the conformance in the future. Currently GDB .debug_names
format has no advantage over GDB .gdb_index format.
* .debug_names from clang (augmentation "LLVM0700"): It can be
produced by clang (clang -gdwarf-5 -gpubnames) for LLDB. It is
conforming to [http://www.dwarfstd.org/doc/DWARF5.pdf
standard], one can expect GDB will be able to read it in the future.
It would be good to produce index from GCC by GDB and to produce index
from clang by clang as the compatibility inside the same toolchain is
best tested and supported. Using index across toolchains (index from
GDB by LLDB or index from clang by GDB) should theoretically work but
in practice there exist subtle differences in interpretation of more
complicated DWARF constructs. It would be best to fix those but that
will be always an afterthought.
== Benefit to Fedora ==
* Faster startup of LLDB debugger using Fedora system *.debug files.
== Scope ==
* Proposal owners: It affects all clang-built packages generating
* Other developers: none
* Policies and guidelines: All the needed changes should be done in
redhat-rpm-config]. The [https://src.fedoraproject.org/rpms/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.
Currently the change will affect only packages using:
%global toolchain clang
Those are currently only these packages being built by clang and using
this %toolchain framework: dotnet3.1 libcxxabi mtxclient nheko simde
FIXME: Which other Fedora packages are being built by clang?
== Upgrade/compatibility impact ==
Existing tools not supporting .debug_names will just ignore the
additional ELF section. The only issue is current GDB would get
confused by the clang .debug_names as it expects .debug_names to be in
its incompatible GDB format - FIXME: Provide a GDB bugfix patch.
Also each *-debuginfo.rpm has to exactly match NVRA of its binary
package the Fedora change compatibility is not applicable.
== How To Test ==
GDB should not get affected by the new .debug_names index from clang.
LLDB should load Fedora system *.debug files faster. LLDB
functionality should not be affected by the index from clang (that is
a part of LLVM development/testsuite).
"llvm-dwarfdump -debug-names *.debug" should show: Augmentation:
== User Experience ==
No user visible change. This affects what tools can developers use.
== Dependencies ==
This Change is dependent on how is decided [[Changes/DebugInfoStandardization]].
This Change is dependent on RHEL-5 F-34 feature expected to be filed
by Mark Wielaard.
Mass rebuild is not required. Packages inherited from F-33 will just
miss the LLDB index and LLDB will load them more slower.
* .debug_names would need to be updated by DWZ but DWZ does not plan
to support .debug_names (according to Mark Wielaard).
** If DWZ is dropped ([[Changes/DebugInfoStandardization]] gets
approved) then clang can normally produce .debug_names for LLDB.
** If DWZ stays in use ([[Changes/DebugInfoStandardization]] gets
rejected) then there are multiple options. LLDB currently cannot
produce .debug_names (only clang can). GDB currently produces
incompatible .debug_names format.
*** [[Changes/DebugInfoStandardization]] should be applied at least
for clang-built packages, preferred by this proposal.
*** There was an idea DWZ would remove .debug_names. That would
effectively reject this Change and make LLVM Toolchain slower due to a
deficiency of the DWZ tool.
*** There isn't anyone willing to implement updating of .debug_names
into DWZ, moreover DWARF-5 standard does not specify a needed format
for combination of both DWZ and .debug_names. Also LLDB currently does
not support the DWZ format anyway.
*** When GDB produces .debug_names compatible with DWARF-5 in the
future it could theoretically produce .debug_names for LLDB. But that
would mean the index for LLDB (and therefore interpretation of DWARF
by LLDB) would be affected by interpretation of DWARF by GDB, that is
a toolchain compatibility nightmare.
* clang produces more effective .debug_names (one per executable; not
one per *.o compilation unit) when using -flto which is
[[LTOByDefault|default since F-33]] now.
== Contingency Plan ==
* Contingency mechanism: Revert the change in
redhat-rpm-config]. LLDB can continue loading Fedora system *.debug
files slightly slower.
* Contingency deadline: beta freeze
* Blocks release? No
* Blocks product? N/A
== Documentation ==
DWARF-5] 6.1.1 Lookup by Name
He / Him / His
Senior Program Manager, Fedora & CentOS Stream