Commit graph

9 commits

Author SHA1 Message Date
Tom Tromey
52e5e48e53 Write the DWARF index in the background
The new DWARF cooked indexer interacts poorly with the DWARF index
cache.  In particular, the cache will require gdb to wait for the
cooked index to be finalized.  As this happens in the foreground, it
means that users with this setting enabled will see a slowdown.

This patch changes gdb to write the cache entry a worker thread.  (As
usual, in the absence of threads, this work is simply done immediately
in the main thread.)

Some care is taken to ensure that this can't crash, and that gdb will
not exit before the task is complete.

To avoid use-after-free problems, the DWARF per-BFD object explicitly
waits for the index cache task to complete.

To avoid gdb exiting early, an exit observer is used to wait for all
such pending tasks.

In normal use, neither of these waits will be very visible.  For users
using "-batch" to pre-generate the index, though, it would be.
However I don't think there is much to be done about this, as it was
the status quo ante.
2023-02-24 11:46:53 -07:00
Simon Marchi
19455ee11d gdb/dwarf: rename cooked_index_vector to cooked_index
See previous patch's commit message for rationale.

Change-Id: I6b8cdc045dffccc1c01ed690ff258af09f6ff076
Approved-By: Tom Tromey <tom@tromey.com>
2023-01-31 22:03:40 -05:00
Joel Brobecker
213516ef31 Update copyright year range in header of all files managed by GDB
This commit is the result of running the gdb/copyright.py script,
which automated the update of the copyright year range for all
source files managed by the GDB project to be updated to include
year 2023.
2023-01-01 17:01:16 +04:00
Tom Tromey
758ffab46b Fix crash when creating index from index
My patches yesterday to unify the DWARF index base classes had a bug
-- namely, I did the wholesale dynamic_cast-to-static_cast too hastily
and introduced a crash.  This can be seen by trying to add an index to
a file that has an index, or by running a test like gdb-index-cxx.exp
using the cc-with-debug-names.exp target board.

This patch fixes the crash by introducing a new virtual method and
removing some of the static casts.
2022-05-04 08:38:05 -06:00
Tom Tromey
f75a1d3a73 Add an ad hoc version check to dwarf_scanner_base
Some generic code in the DWARF reader has a special case for older
versions of .gdb_index.  This patch adds an ad hoc version check
method so that these spots can work without specific knowledge of
which index is in use.
2022-04-20 09:10:03 -06:00
Tom Tromey
6606799fc4 Introduce and use dwarf_scanner_base
This introduces dwarf_scanner_base, a base class for all the index
readers in the DWARF code.  Then, it changes both mapped_index_base
and cooked_index_vector to derive from this new base class.
2022-04-20 09:10:03 -06:00
Tom Tromey
32ae6b930c Let mapped index classes create the quick_symbol_functions object
This changes the mapped index classes to create the
quick_symbol_functions objects.  This is a step toward having a more
abstract interface to mapped indices.
2022-04-20 09:10:03 -06:00
Tom Tromey
6555809e3e Give mapped_index_base a virtual destructor
This changes mapped_index_base to have a virtual destructor, so it can
be destroyed via its base class.
2022-04-20 09:10:03 -06:00
Tom Tromey
20386fa32d Move mapped_index_base to new header file
This moves mapped_index_base and the helper struct name_component to a
new header file in gdb/dwarf2/.
2022-04-20 09:10:03 -06:00