public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: Tom Tromey <tom@tromey.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH v3 00/18] Index DWARF in the background
Date: Mon, 27 Nov 2023 16:31:38 +0100	[thread overview]
Message-ID: <ac4ca8f9-d680-442d-b005-be6ddf5ddec2@suse.de> (raw)
In-Reply-To: <20231122-t-bg-dwarf-reading-v3-0-fc3180de63c4@tromey.com>

On 11/23/23 06:32, Tom Tromey wrote:
> 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".
> 

I've tested the series with target boards:
- unix
- cc-with-dwz
- cc-with-index-cache
and found no new issues.

I've also test-driven it a bit, indeed it makes gdb feel more 
responsive, I think it's a nice improvement.

Thanks,
- Tom


> ---
> 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 (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                                         |   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/cooked-index.c                        | 201 ++++---
>   gdb/dwarf2/cooked-index.h                        | 316 ++++++++--
>   gdb/dwarf2/dwz.c                                 |  90 ++-
>   gdb/dwarf2/dwz.h                                 |  13 +-
>   gdb/dwarf2/macro.c                               |   2 -
>   gdb/dwarf2/public.h                              |  18 +-
>   gdb/dwarf2/read.c                                | 729 +++++++++++++----------
>   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, 1409 insertions(+), 930 deletions(-)
> ---
> base-commit: a54a99a6e5159e4406e172f074b3729b2135c28c
> change-id: 20231112-t-bg-dwarf-reading-00b65fa130b3
> 
> Best regards,


  parent reply	other threads:[~2023-11-27 15:31 UTC|newest]

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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ac4ca8f9-d680-442d-b005-be6ddf5ddec2@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).