From Fedora Project Wiki

GdbIndex

Summary

Currently gdb startup time is slow due to the lack of usable DWARF indices. At the same time, the .debug files include indices which are not usable.

This project will remove the useless indices from the .debug files, and will replace them with an index that greatly speeds up gdb.

Owner

  • Email: tromey@redhat.com

Current status

  • Targeted release: Releases/14
  • Last updated: 2010-09-15
  • Percentage of completion: 100%


Detailed Description

The current DWARF sections .debug_pubnames and .debug_pubtypes are not usable by gdb for various reasons: they are historically buggy (and thus unreliable), they don't include all symbols (so using them would result in user-visible behavior changes), and they do not have canonicalized C++ names (so reading them is still slow).

To the best of my knowledge no program in the distro (and probably no program anywhere) uses these sections. They are just wasted space.

A gdb branch, part of the archer project, lets gdb create an mmap()able index. This index greatly speeds up startup time. E.g., it results in a 10x improvement for "gdb gdb".

Benefit to Fedora

Removing the unused DWARF sections will save space and possible reduce compile and link times (perhaps minutely).

The index will make gdb much faster.

Scope

The work consists of three separate parts:

  • Modify gdb to create and use an index. This is complete and submitted to upstream GDB. It will end up in the Fedora GDB RPM either via upstream or as a (temporary) Fedora patch.
  • Change gcc not to emit the various unused indices. The patch has been checked in upstream.
  • Change find-debuginfo.sh to invoke gdb to create the index when the separate debuginfo files are created. The patch has been submitted to the Fedora RPM maintainer.

How To Test

A simple test would be to time "gdb gdb", then make an index for gdb and do it again. Another test would be to examine objdump output (on just about any executable compiled with -g) to verify that the index sections do not exist.

User Experience

Users will notice a drastic speedup when debugging executables or libraries that have an index.

Dependencies

Various programs depend on DWARF: valgrind, elfutils, binutils, gdb, dwarves.

This will also affect gcc and whatever package strips debuginfo.

Contingency Plan

No contingency plan is necessary.

Documentation

The existing indices are described in the DWARF standard.

The new index file is described only by a comment in the gdb sources.

gdb-7.2-3.fc14 or later is required. To cover also glibc by .gdb_index the Koji buildroot will need to include elfutils-0.149-1.fc14 (631997). There has been no mass rebuild with .gdb_index and therefore some F14 rpms still do not feature .gdb_index.

Release Notes

  • gdb has been enhanced to remove the unncecssary indices from the .debug files, and will replace them with an index that greatly speeds up gdb.

Comments and Discussion