binutils-gdb/gdbsupport
Tom Tromey 20a26f4e01 Finalize each cooked index separately
After DWARF has been scanned, the cooked index code does a
"finalization" step in a worker thread.  This step combines all the
index entries into a single master list, canonicalizes C++ names, and
splits Ada names to synthesize package names.

While this step is run in the background, gdb will wait for the
results in some situations, and it turns out that this step can be
slow.  This is PR symtab/29105.

This can be sped up by parallelizing, at a small memory cost.  Now
each index is finalized on its own, in a worker thread.  The cost
comes from name canonicalization: if a given non-canonical name is
referred to by multiple indices, there will be N canonical copies (one
per index) rather than just one.

This requires changing the users of the index to iterate over multiple
results.  However, this is easily done by introducing a new "chained
range" class.

When run on gdb itself, the memory cost seems rather low -- on my
current machine, "maint space 1" reports no change due to the patch.

For performance testing, using "maint time 1" and "file" will not show
correct results.  That approach measures "time to next prompt", but
because the patch only affects background work, this shouldn't (and
doesn't) change.  Instead, a simple way to make gdb wait for the
results is to set a breakpoint.

Before:

    $ /bin/time -f%e ~/gdb/install/bin/gdb -nx -q -batch \
        -ex 'break main' /tmp/gdb
    Breakpoint 1 at 0x43ec30: file ../../binutils-gdb/gdb/gdb.c, line 28.
    2.00

After:

    $ /bin/time -f%e ./gdb/gdb -nx -q -batch \
        -ex 'break main' /tmp/gdb
    Breakpoint 1 at 0x43ec30: file ../../binutils-gdb/gdb/gdb.c, line 28.
    0.65

Regression tested on x86-64 Fedora 34.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29105
2022-05-26 07:35:30 -06:00
..
.dir-locals.el
.gitattributes
acinclude.m4
aclocal.m4
agent.cc
agent.h
alt-stack.h
array-view.h
ax.def
block-signals.h
break-common.h
btrace-common.cc
btrace-common.h
buffer.cc
buffer.h
buildargv.h
byte-vector.h
ChangeLog-2020-2021
check-defines.el
cleanups.cc
cleanups.h
common-debug.cc
common-debug.h
common-defs.h Consolidate definition of current_directory 2022-03-30 09:08:48 -06:00
common-exceptions.cc
common-exceptions.h Specialize std::hash for gdb_exception 2022-04-12 09:31:16 -06:00
common-gdbthread.h
common-inferior.cc
common-inferior.h
common-regcache.cc
common-regcache.h
common-types.h
common-utils.cc
common-utils.h
common.m4 Let std::thread check pass even without pthreads 2022-04-14 09:28:56 -06:00
compiler-type.m4
config.in
configure Let std::thread check pass even without pthreads 2022-04-14 09:28:56 -06:00
configure.ac gdbsupport: Add an event-pipe class. 2022-02-22 11:22:14 -08:00
create-version.sh
def-vector.h
default-init-alloc.h
eintr.h
enum-flags.h
environ.cc
environ.h
errors.cc
errors.h
event-loop.cc Reindent gdbsupport/event-loop.cc:handle_file_event 2022-05-16 19:58:08 +01:00
event-loop.h
event-pipe.cc Fix typo in last change. 2022-03-03 13:06:50 -08:00
event-pipe.h Avoid conflict with gnulib open/close macros. 2022-03-03 11:21:36 -08:00
fileio.cc
fileio.h
filestuff.cc
filestuff.h
filtered-iterator.h
format.cc
format.h
forward-scope-exit.h
function-view.h
gdb_assert.h
gdb_binary_search.h
gdb_file.h
gdb_locale.h
gdb_obstack.cc
gdb_obstack.h
gdb_optional.h
gdb_proc_service.h
gdb_ref_ptr.h
gdb_regex.cc gdbsupport/gdb_regex.cc: replace defs.h include with common-defs.h 2022-01-20 22:58:21 -05:00
gdb_regex.h Move gdb_regex to gdbsupport 2022-01-18 10:14:43 -07:00
gdb_select.h
gdb_setjmp.h
gdb_signals.h
gdb_splay_tree.h
gdb_string_view.h
gdb_string_view.tcc
gdb_sys_time.h
gdb_tilde_expand.cc gdb: use gdb_tilde_expand instead of gdb_tilde_expand_up in source_script_with_search 2022-04-18 15:48:03 -04:00
gdb_tilde_expand.h gdb: use gdb_tilde_expand instead of gdb_tilde_expand_up in source_script_with_search 2022-04-18 15:48:03 -04:00
gdb_unique_ptr.h gdb: add operator+= and operator+ overload for std::string 2022-02-25 17:50:22 +00:00
gdb_unlinker.h
gdb_vecs.cc
gdb_vecs.h
gdb_wait.cc
gdb_wait.h
gdb-dlfcn.cc
gdb-dlfcn.h
gdb-hashtab.cc
gdb-hashtab.h
gdb-safe-ctype.h
gdb-sigmask.h
gdb-xfree.h
hash_enum.h
host-defs.h
intrusive_list.h Make intrusive_list_node's next/prev private 2022-04-13 10:24:38 +01:00
iterator-range.h
job-control.cc
job-control.h
Makefile.am gdbsupport: Add an event-pipe class. 2022-02-22 11:22:14 -08:00
Makefile.in gdbsupport: Add an event-pipe class. 2022-02-22 11:22:14 -08:00
netstuff.cc
netstuff.h
new-op.cc
next-iterator.h
observable.h Move non-dependent gdb::observers::observable::visit_state outside template 2022-05-10 13:40:57 +01:00
offset-type.h
parallel-for.h Fix --disable-threading build 2022-05-10 08:15:40 -06:00
pathstuff.cc gdbsupport: fix path_join crash with -std=c++17 and -D_GLIBCXX_DEBUG 2022-05-19 08:04:13 -04:00
pathstuff.h gdbsupport/pathstuff.h: #include <array> explicitly for std::array<> 2022-04-25 17:06:09 -07:00
poison.h
preprocessor.h
print-utils.cc [gdbsupport] Fix UB in print-utils.cc:int_string 2022-05-23 14:50:02 +02:00
print-utils.h
ptid.cc
ptid.h
ptrace.m4
range-chain.h Finalize each cooked index separately 2022-05-26 07:35:30 -06:00
README
refcounted-object.h
reference-to-pointer-iterator.h
rsp-low.cc
rsp-low.h
run-time-clock.cc
run-time-clock.h
safe-iterator.h
safe-strerror.cc
scope-exit.h
scoped_fd.h
scoped_ignore_signal.h
scoped_ignore_sigttou.h
scoped_mmap.cc
scoped_mmap.h
scoped_restore.h
search.cc
search.h
selftest.cc gdbsupport/selftest: Allow lazy registration 2022-04-19 09:12:42 +01:00
selftest.h gdbsupport/selftest: Allow lazy registration 2022-04-19 09:12:42 +01:00
selftest.m4
signals-state-save-restore.cc
signals-state-save-restore.h
signals.cc
symbol.h
tdesc.cc
tdesc.h
thread-pool.cc Fix --disable-threading build 2022-05-10 08:15:40 -06:00
thread-pool.h Fix --disable-threading build 2022-05-10 08:15:40 -06:00
traits.h
underlying.h
valid-expr.h
version.h
warning.m4
x86-xstate.h
xml-utils.cc
xml-utils.h

This is a helper library that is used by gdb and gdbserver.

To send patches, follow the gdb patch submission instructions in
../gdb/CONTRIBUTE.  For maintainers, see ../gdb/MAINTAINERS.