public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v2 00/18] Index DWARf in the background
@ 2023-11-12 20:25 Tom Tromey
  2023-11-12 20:25 ` [PATCH v2 01/18] Don't use objfile::intern in DWO code Tom Tromey
                   ` (17 more replies)
  0 siblings, 18 replies; 25+ messages in thread
From: Tom Tromey @ 2023-11-12 20:25 UTC (permalink / raw)
  To: gdb-patches

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>


^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2023-11-21 14:24 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-12 20:25 [PATCH v2 00/18] Index DWARf in the background Tom Tromey
2023-11-12 20:25 ` [PATCH v2 01/18] Don't use objfile::intern in DWO code Tom Tromey
2023-11-12 20:25 ` [PATCH v2 02/18] Pre-read DWZ section data Tom Tromey
2023-11-12 20:25 ` [PATCH v2 03/18] Add a couple of bfd_cache_close calls Tom Tromey
2023-11-12 20:25 ` [PATCH v2 04/18] Add thread-safety to gdb's BFD wrappers Tom Tromey
2023-11-12 20:25 ` [PATCH v2 05/18] Refactor complaint thread-safety approach Tom Tromey
2023-11-12 20:25 ` [PATCH v2 06/18] Add quick_symbol_functions::compute_main_name Tom Tromey
2023-11-12 20:25 ` [PATCH v2 07/18] Add gdb::task_group Tom Tromey
2023-11-12 20:25 ` [PATCH v2 08/18] Move cooked_index_storage to cooked-index.h Tom Tromey
2023-11-12 20:25 ` [PATCH v2 09/18] Add "maint set dwarf synchronous" Tom Tromey
2023-11-13 13:43   ` Eli Zaretskii
2023-11-12 20:25 ` [PATCH v2 10/18] Change how cooked index waits for threads Tom Tromey
2023-11-12 20:25 ` [PATCH v2 11/18] Do more DWARF reading in the background Tom Tromey
2023-11-13  7:15   ` Tom de Vries
2023-11-13 17:56     ` John Baldwin
2023-11-13 19:39       ` Tom de Vries
2023-11-14 17:31         ` John Baldwin
2023-11-21 14:24           ` Tom Tromey
2023-11-12 20:25 ` [PATCH v2 12/18] Simplify the public DWARF API Tom Tromey
2023-11-12 20:25 ` [PATCH v2 13/18] Remove two quick_symbol_functions methods Tom Tromey
2023-11-12 20:25 ` [PATCH v2 14/18] Change current_language to be a macro Tom Tromey
2023-11-12 20:25 ` [PATCH v2 15/18] Lazy language setting Tom Tromey
2023-11-12 20:25 ` [PATCH v2 16/18] Optimize lookup_minimal_symbol_text Tom Tromey
2023-11-12 20:25 ` [PATCH v2 17/18] Avoid language-based lookups in startup path Tom Tromey
2023-11-12 20:25 ` [PATCH v2 18/18] Back out some parallel_for_each features Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).