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

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.

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 v4:
- Added deferred_warnings patch
- Link to v3: https://inbox.sourceware.org/gdb-patches/20231122-t-bg-dwarf-reading-v3-0-fc3180de63c4@tromey.com

Changes in v3:
- Rebase on top of the C++17 changes
- Apply Tom de Vries' bug fix
- Fix a "save gdb-index" bug found by Alexandra
- Link to v2: https://inbox.sourceware.org/gdb-patches/20231112-t-bg-dwarf-reading-v2-0-70fb170012ba@tromey.com

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 (19):
      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 deferred_warnings parameter to read_addrmap_from_aranges
      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                                         |   4 +
 gdb/breakpoint.c                                 |   4 +-
 gdb/coffread.c                                   |   6 +-
 gdb/complaints.c                                 |  24 +-
 gdb/complaints.h                                 |  37 +-
 gdb/defs.h                                       |   2 +-
 gdb/doc/gdb.texinfo                              |  18 +
 gdb/dwarf2/aranges.c                             |  77 +--
 gdb/dwarf2/aranges.h                             |   3 +-
 gdb/dwarf2/cooked-index.c                        | 201 ++++---
 gdb/dwarf2/cooked-index.h                        | 322 ++++++++--
 gdb/dwarf2/dwz.c                                 |  90 ++-
 gdb/dwarf2/dwz.h                                 |  13 +-
 gdb/dwarf2/macro.c                               |   2 -
 gdb/dwarf2/public.h                              |  18 +-
 gdb/dwarf2/read-debug-names.c                    |   8 +-
 gdb/dwarf2/read.c                                | 733 +++++++++++++----------
 gdb/dwarf2/read.h                                |   5 +-
 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                              |  75 +--
 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/utils.h                                      |  16 +-
 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 ++
 53 files changed, 1480 insertions(+), 974 deletions(-)
---
base-commit: eef4ff9b707d738322a5dca82a6a9b0aad76a26e
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:[~2024-01-09 19:51 UTC | newest]

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