On Tue, Sep 29, 2020 at 4:29 PM Ben Cotton <bcotton(a)redhat.com> wrote:
https://fedoraproject.org/wiki/Changes/DebugInfoLldbIndex
== 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
[
https://www.gnu.org/software/gdb/ GDB debugger].
[
https://lldb.llvm.org/ 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 DWARF-5
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 DWARF-5
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.
Why don't you add an lldb-add-index tool to generate LLVM indexes for
LLDB? Then we just invoke it as part of the buildroot policy setup and
get both GDB and LLDB indexes? This proposal seems to be particularly
destructive to GDB users to favor LLDB.
I personally don't use LLDB for *anything*, since I think it's not a
particularly good debugger right now, and I would not be happy if the
performance of debugging clang-built things with GDB degraded.
== Benefit to Fedora ==
* Faster startup of LLDB debugger using Fedora system *.debug files.
== Scope ==
* Proposal owners: It affects all clang-built packages generating
*-debuginfo.rpm.
* Other developers: none
* Policies and guidelines: All the needed changes should be done in
[
https://src.fedoraproject.org/rpms/redhat-rpm-config
redhat-rpm-config]. The [
https://src.fedoraproject.org/rpms/dwz 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
wine
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:
'LLVM0700'
== User Experience ==
No user visible change. This affects what tools can developers use.
Developers are users. Please include what improvements they will get
from this change here.
== Dependencies ==
This Change is dependent on how is decided [[Changes/DebugInfoStandardization]].
Why? That change is only about dwz, this is about adding indexes for
LLDB to use.
This Change is dependent on RHEL-5 F-34 feature expected to be filed
by Mark Wielaard.
I assume you mean RHEL-9 here. But what change is Mark supposed to be filing?
--
真実はいつも一つ!/ Always, there's only one truth!