aboutsummaryrefslogtreecommitdiff
path: root/gdb/minsyms.c
diff options
context:
space:
mode:
authorChristian Biesinger <cbiesinger@google.com>2019-11-18 20:48:36 -0600
committerChristian Biesinger <cbiesinger@google.com>2019-11-27 15:38:23 -0600
commit62e77f56f0ce8b10122881d8f0acd70e113fde93 (patch)
tree52c2785eed5d10604811d19995270b4afde2fe44 /gdb/minsyms.c
parentf29d7f6b83f60ca8dd64ec89ea803f79324ac12f (diff)
downloadgdb-62e77f56f0ce8b10122881d8f0acd70e113fde93.zip
gdb-62e77f56f0ce8b10122881d8f0acd70e113fde93.tar.gz
gdb-62e77f56f0ce8b10122881d8f0acd70e113fde93.tar.bz2
Turn off threaded minsym demangling by default
Per discussion on gdb-patches with Joel, this patch turns off multihreaded symbol loading by default. It can be turned on using: maint set worker-threads unlimited To keep the behavior as close as possible to the old code, it still calls symbol_set_names in the old place if n_worker_threads is 0. gdb/ChangeLog: 2019-11-27 Christian Biesinger <cbiesinger@google.com> * maint.c (n_worker_threads): Default to 0. (worker_threads_disabled): New function. * maint.h (worker_threads_disabled): New function. * minsyms.c (minimal_symbol_reader::record_full): Call symbol_set_names here if worker_threads_disabled () is true. (minimal_symbol_reader::install): Skip all threading if worker_threads_disabled () is true. Change-Id: I92ba4f6bbf07363189666327cad452d6b9c8e01d
Diffstat (limited to 'gdb/minsyms.c')
-rw-r--r--gdb/minsyms.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index 94240c9..4f7260b 100644
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -54,6 +54,7 @@
#include <algorithm>
#include "safe-ctype.h"
#include "gdbsupport/parallel-for.h"
+#include "maint.h"
#if CXX_STD_THREAD
#include <mutex>
@@ -1137,6 +1138,15 @@ minimal_symbol_reader::record_full (gdb::string_view name,
else
msymbol->name = name.data ();
+ if (worker_threads_disabled ())
+ {
+ /* To keep our behavior as close as possible to the previous non-threaded
+ behavior for GDB 9.1, we call symbol_set_names here when threads
+ are disabled. */
+ symbol_set_names (msymbol, msymbol->name, false, m_objfile->per_bfd);
+ msymbol->name_set = 1;
+ }
+
SET_MSYMBOL_VALUE_ADDRESS (msymbol, address);
MSYMBOL_SECTION (msymbol) = section;
@@ -1407,10 +1417,12 @@ minimal_symbol_reader::install ()
(msym, demangled_name,
&m_objfile->per_bfd->storage_obstack);
msym->name_set = 1;
-
- hash_values[idx].mangled_name_hash
- = fast_hash (msym->name, hash_values[idx].name_length);
}
+ /* This mangled_name_hash computation has to be outside of
+ the name_set check, or symbol_set_names below will
+ be called with an invalid hash value. */
+ hash_values[idx].mangled_name_hash
+ = fast_hash (msym->name, hash_values[idx].name_length);
hash_values[idx].minsym_hash
= msymbol_hash (msym->linkage_name ());
/* We only use this hash code if the search name differs