[PATCH v2 00/18] Index DWARf in the background
Tom Tromey
tom@tromey.com
Sun Nov 12 20:25:37 GMT 2023
This series changes gdb to do its initial DWARF indexing in the
background.
This process is mostly asynchronous with respect to the rest of gdb.
That is, rather than pre-emptively waiting for scanning to complete,
now gdb's main thread will only wait when some result of the scan is
required.
This drastically improves gdb's apparent startup time in the "normal"
case where a user does "gdb some-executable" -- e.g., for starting gdb
on itself, the time until the prompt returns goes from ~1.2 seconds to
~0.06 seconds on my machine.
This approach works by hiding most of the work from the user. Waiting
can still be needed; for example if one starts gdb and immediately
sets a breakpoint -- however, because the indexer is reasonably fast,
and human reaction times are slow, this series still manages to be
fairly successful.
My current belief is that doing any better than this will probably
require a new debug format that isn't quite so cursed to read.
This series requires the BFD threading series I posted to the binutils
list, and the DWZ refactoring patch I sent recently.
I regression tested this on x86-64 Fedora 38. I've also built it with
TSAN and tested that, though TSAN seems to introduce random timeouts
into the testsuite when I use "make -j8 check".
---
Changes in v2:
- Updated to final style of BFD locking
- Added a thread safety fix for DWO
- Added a patch to pre-read DWZ sections
- Added calls to bfd_thread_cleanup and bfd_cache_close
- Link to v1: https://inbox.sourceware.org/gdb-patches/20231029173839.471514-1-tom@tromey.com
---
Tom Tromey (18):
Don't use objfile::intern in DWO code
Pre-read DWZ section data
Add a couple of bfd_cache_close calls
Add thread-safety to gdb's BFD wrappers
Refactor complaint thread-safety approach
Add quick_symbol_functions::compute_main_name
Add gdb::task_group
Move cooked_index_storage to cooked-index.h
Add "maint set dwarf synchronous"
Change how cooked index waits for threads
Do more DWARF reading in the background
Simplify the public DWARF API
Remove two quick_symbol_functions methods
Change current_language to be a macro
Lazy language setting
Optimize lookup_minimal_symbol_text
Avoid language-based lookups in startup path
Back out some parallel_for_each features
gdb/NEWS | 3 +
gdb/breakpoint.c | 4 +-
gdb/coffread.c | 8 +-
gdb/complaints.c | 24 +-
gdb/complaints.h | 37 +-
gdb/defs.h | 2 +-
gdb/doc/gdb.texinfo | 14 +
gdb/dwarf2/cooked-index.c | 206 ++++---
gdb/dwarf2/cooked-index.h | 315 ++++++++--
gdb/dwarf2/dwz.c | 90 ++-
gdb/dwarf2/dwz.h | 13 +-
gdb/dwarf2/macro.c | 2 -
gdb/dwarf2/public.h | 18 +-
gdb/dwarf2/read.c | 724 +++++++++++++----------
gdb/dwarf2/read.h | 2 +-
gdb/elfread.c | 6 +-
gdb/gdb_bfd.c | 58 ++
gdb/gdb_bfd.h | 5 +
gdb/gdbthread.h | 3 +-
gdb/jit.c | 4 +-
gdb/language.c | 51 +-
gdb/language.h | 34 +-
gdb/machoread.c | 11 +-
gdb/main.c | 3 +-
gdb/minsyms.c | 69 ++-
gdb/objfile-flags.h | 4 -
gdb/objfiles.h | 17 +-
gdb/psymtab.c | 1 -
gdb/quick-symbol.h | 17 +-
gdb/symfile-debug.c | 77 +--
gdb/symfile.c | 22 +-
gdb/symtab.c | 2 +
gdb/testsuite/gdb.dwarf2/dw2-error.exp | 1 +
gdb/testsuite/gdb.dwarf2/dw2-missing-cu-tag.exp | 2 +
gdb/testsuite/gdb.dwarf2/dw2-stack-boundary.exp | 2 +
gdb/testsuite/gdb.dwarf2/dw2-using-debug-str.exp | 2 +
gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp | 4 +-
gdb/testsuite/gdb.dwarf2/fission-reread.exp | 5 +-
gdb/testsuite/gdb.dwarf2/no-gnu-debuglink.exp | 1 +
gdb/testsuite/gdb.dwarf2/struct-with-sig-2.exp | 10 +-
gdb/thread.c | 8 +-
gdb/top.c | 2 +-
gdb/unittests/parallel-for-selftests.c | 47 --
gdb/xcoffread.c | 3 +-
gdbsupport/Makefile.am | 1 +
gdbsupport/Makefile.in | 6 +-
gdbsupport/parallel-for.h | 234 +-------
gdbsupport/task-group.cc | 97 +++
gdbsupport/task-group.h | 64 ++
49 files changed, 1401 insertions(+), 934 deletions(-)
---
base-commit: 328e01595436e937a0cc00cc8451f17beda26799
change-id: 20231112-t-bg-dwarf-reading-00b65fa130b3
Best regards,
--
Tom Tromey <tom@tromey.com>
More information about the Gdb-patches
mailing list