* [review] Turn off threaded minsym demangling by default
@ 2019-11-19 3:00 Christian Biesinger (Code Review)
2019-11-19 21:54 ` Christian Biesinger (Code Review)
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: Christian Biesinger (Code Review) @ 2019-11-19 3:00 UTC (permalink / raw)
To: gdb-patches; +Cc: Christian Biesinger
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/687
......................................................................
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-18 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
---
M gdb/maint.c
M gdb/maint.h
M gdb/minsyms.c
3 files changed, 47 insertions(+), 30 deletions(-)
diff --git a/gdb/maint.c b/gdb/maint.c
index fce1a1c..3e14c3e 100644
--- a/gdb/maint.c
+++ b/gdb/maint.c
@@ -845,7 +845,12 @@
}
#endif
-static int n_worker_threads = -1;
+static int n_worker_threads = 0;
+
+bool worker_threads_disabled ()
+{
+ return n_worker_threads == 0;
+}
/* Update the thread pool for the desired number of threads. */
static void
diff --git a/gdb/maint.h b/gdb/maint.h
index 827964d..cbaf9de 100644
--- a/gdb/maint.h
+++ b/gdb/maint.h
@@ -26,6 +26,8 @@
extern void set_per_command_space (int);
+extern bool worker_threads_disabled ();
+
/* Records a run time and space usage to be used as a base for
reporting elapsed time or change in space. */
diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index f9d1172..b59b96d 100644
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -53,6 +53,7 @@
#include "gdbsupport/symbol.h"
#include <algorithm>
#include "safe-ctype.h"
+#include "maint.h"
#include "gdbsupport/parallel-for.h"
#if CXX_STD_THREAD
@@ -1139,6 +1140,12 @@
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);
+
SET_MSYMBOL_VALUE_ADDRESS (msymbol, address);
MSYMBOL_SECTION (msymbol) = section;
@@ -1364,43 +1371,46 @@
m_objfile->per_bfd->minimal_symbol_count = mcount;
m_objfile->per_bfd->msymbols = std::move (msym_holder);
+ if (!worker_threads_disabled ())
+ {
#if CXX_STD_THREAD
- /* Mutex that is used when modifying or accessing the demangled
- hash table. */
- std::mutex demangled_mutex;
+ /* Mutex that is used when modifying or accessing the demangled
+ hash table. */
+ std::mutex demangled_mutex;
#endif
- msymbols = m_objfile->per_bfd->msymbols.get ();
- gdb::parallel_for_each
- (&msymbols[0], &msymbols[mcount],
- [&] (minimal_symbol *start, minimal_symbol *end)
- {
- for (minimal_symbol *msym = start; msym < end; ++msym)
+ msymbols = m_objfile->per_bfd->msymbols.get ();
+ gdb::parallel_for_each
+ (&msymbols[0], &msymbols[mcount],
+ [&] (minimal_symbol *start, minimal_symbol *end)
{
- if (!msym->name_set)
+ for (minimal_symbol *msym = start; msym < end; ++msym)
{
- /* This will be freed later, by symbol_set_names. */
- char *demangled_name
- = symbol_find_demangled_name (msym, msym->name);
- symbol_set_demangled_name
- (msym, demangled_name,
- &m_objfile->per_bfd->storage_obstack);
- msym->name_set = 1;
+ if (!msym->name_set)
+ {
+ /* This will be freed later, by symbol_set_names. */
+ char *demangled_name
+ = symbol_find_demangled_name (msym, msym->name);
+ symbol_set_demangled_name
+ (msym, demangled_name,
+ &m_objfile->per_bfd->storage_obstack);
+ msym->name_set = 1;
+ }
}
- }
- {
- /* To limit how long we hold the lock, we only acquire it here
- and not while we demangle the names above. */
-#if CXX_STD_THREAD
- std::lock_guard<std::mutex> guard (demangled_mutex);
-#endif
- for (minimal_symbol *msym = start; msym < end; ++msym)
{
- symbol_set_names (msym, msym->name, false,
- m_objfile->per_bfd);
+ /* To limit how long we hold the lock, we only acquire it here
+ and not while we demangle the names above. */
+#if CXX_STD_THREAD
+ std::lock_guard<std::mutex> guard (demangled_mutex);
+#endif
+ for (minimal_symbol *msym = start; msym < end; ++msym)
+ {
+ symbol_set_names (msym, msym->name, false,
+ m_objfile->per_bfd);
+ }
}
- }
- });
+ });
+ }
build_minimal_symbol_hash_tables (m_objfile);
}
--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I92ba4f6bbf07363189666327cad452d6b9c8e01d
Gerrit-Change-Number: 687
Gerrit-PatchSet: 1
Gerrit-Owner: Christian Biesinger <cbiesinger@google.com>
Gerrit-MessageType: newchange
^ permalink raw reply [flat|nested] 7+ messages in thread
* [review] Turn off threaded minsym demangling by default
2019-11-19 3:00 [review] Turn off threaded minsym demangling by default Christian Biesinger (Code Review)
@ 2019-11-19 21:54 ` Christian Biesinger (Code Review)
2019-11-22 23:48 ` Tom Tromey (Code Review)
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Christian Biesinger (Code Review) @ 2019-11-19 21:54 UTC (permalink / raw)
To: Christian Biesinger, gdb-patches
Christian Biesinger has posted comments on this change.
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/687
......................................................................
Patch Set 1:
tromey -- sorry I missed your IRC question; here I did more than just change the setting because I was concerned that deferring the symbol_set_names call may have a risk in case some code relies on the name being set earlier. Beyond that I skipped all the threading set up because it's not necessary with that first part. But if you think I'm overly cautious I'm fine with not doing that.
--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I92ba4f6bbf07363189666327cad452d6b9c8e01d
Gerrit-Change-Number: 687
Gerrit-PatchSet: 1
Gerrit-Owner: Christian Biesinger <cbiesinger@google.com>
Gerrit-Reviewer: Christian Biesinger <cbiesinger@google.com>
Gerrit-Comment-Date: Tue, 19 Nov 2019 21:54:01 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
^ permalink raw reply [flat|nested] 7+ messages in thread
* [review] Turn off threaded minsym demangling by default
2019-11-19 3:00 [review] Turn off threaded minsym demangling by default Christian Biesinger (Code Review)
2019-11-19 21:54 ` Christian Biesinger (Code Review)
@ 2019-11-22 23:48 ` Tom Tromey (Code Review)
2019-11-26 21:53 ` [review v2] " Christian Biesinger (Code Review)
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Tom Tromey (Code Review) @ 2019-11-22 23:48 UTC (permalink / raw)
To: Christian Biesinger, gdb-patches
Tom Tromey has posted comments on this change.
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/687
......................................................................
Patch Set 1: Code-Review+2
I finally got around to reading this.
I think this makes sense. And, I think it's fine to revert immediately
after the 9.1 branch is created.
Thanks for doing this.
--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I92ba4f6bbf07363189666327cad452d6b9c8e01d
Gerrit-Change-Number: 687
Gerrit-PatchSet: 1
Gerrit-Owner: Christian Biesinger <cbiesinger@google.com>
Gerrit-Reviewer: Christian Biesinger <cbiesinger@google.com>
Gerrit-Reviewer: Tom Tromey <tromey@sourceware.org>
Gerrit-Comment-Date: Fri, 22 Nov 2019 23:48:25 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
^ permalink raw reply [flat|nested] 7+ messages in thread
* [review v2] Turn off threaded minsym demangling by default
2019-11-19 3:00 [review] Turn off threaded minsym demangling by default Christian Biesinger (Code Review)
2019-11-19 21:54 ` Christian Biesinger (Code Review)
2019-11-22 23:48 ` Tom Tromey (Code Review)
@ 2019-11-26 21:53 ` Christian Biesinger (Code Review)
2019-11-26 21:55 ` Tom Tromey (Code Review)
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Christian Biesinger (Code Review) @ 2019-11-26 21:53 UTC (permalink / raw)
To: Christian Biesinger, Tom Tromey, gdb-patches
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/687
......................................................................
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-18 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
---
M gdb/maint.c
M gdb/maint.h
M gdb/minsyms.c
3 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/gdb/maint.c b/gdb/maint.c
index 7ab3fdb..dbc949a 100644
--- a/gdb/maint.c
+++ b/gdb/maint.c
@@ -845,7 +845,12 @@
}
#endif
-static int n_worker_threads = -1;
+static int n_worker_threads = 0;
+
+bool worker_threads_disabled ()
+{
+ return n_worker_threads == 0;
+}
/* Update the thread pool for the desired number of threads. */
static void
diff --git a/gdb/maint.h b/gdb/maint.h
index 827964d..cbaf9de 100644
--- a/gdb/maint.h
+++ b/gdb/maint.h
@@ -26,6 +26,8 @@
extern void set_per_command_space (int);
+extern bool worker_threads_disabled ();
+
/* Records a run time and space usage to be used as a base for
reporting elapsed time or change in space. */
diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index b752b3a..de8cb78 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 @@
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;
@@ -1401,10 +1411,12 @@
(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 ());
hash_values[idx].minsym_demangled_hash
--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I92ba4f6bbf07363189666327cad452d6b9c8e01d
Gerrit-Change-Number: 687
Gerrit-PatchSet: 2
Gerrit-Owner: Christian Biesinger <cbiesinger@google.com>
Gerrit-Reviewer: Christian Biesinger <cbiesinger@google.com>
Gerrit-Reviewer: Tom Tromey <tromey@sourceware.org>
Gerrit-MessageType: newpatchset
^ permalink raw reply [flat|nested] 7+ messages in thread
* [review v2] Turn off threaded minsym demangling by default
2019-11-19 3:00 [review] Turn off threaded minsym demangling by default Christian Biesinger (Code Review)
` (2 preceding siblings ...)
2019-11-26 21:53 ` [review v2] " Christian Biesinger (Code Review)
@ 2019-11-26 21:55 ` Tom Tromey (Code Review)
2019-11-27 21:40 ` [pushed] " Sourceware to Gerrit sync (Code Review)
2019-11-27 21:40 ` Sourceware to Gerrit sync (Code Review)
5 siblings, 0 replies; 7+ messages in thread
From: Tom Tromey (Code Review) @ 2019-11-26 21:55 UTC (permalink / raw)
To: Christian Biesinger, gdb-patches
Tom Tromey has posted comments on this change.
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/687
......................................................................
Patch Set 2: Code-Review+2
Still looks good. Thanks for doing this.
--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I92ba4f6bbf07363189666327cad452d6b9c8e01d
Gerrit-Change-Number: 687
Gerrit-PatchSet: 2
Gerrit-Owner: Christian Biesinger <cbiesinger@google.com>
Gerrit-Reviewer: Christian Biesinger <cbiesinger@google.com>
Gerrit-Reviewer: Tom Tromey <tromey@sourceware.org>
Gerrit-Comment-Date: Tue, 26 Nov 2019 21:55:53 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
^ permalink raw reply [flat|nested] 7+ messages in thread
* [pushed] Turn off threaded minsym demangling by default
2019-11-19 3:00 [review] Turn off threaded minsym demangling by default Christian Biesinger (Code Review)
` (4 preceding siblings ...)
2019-11-27 21:40 ` [pushed] " Sourceware to Gerrit sync (Code Review)
@ 2019-11-27 21:40 ` Sourceware to Gerrit sync (Code Review)
5 siblings, 0 replies; 7+ messages in thread
From: Sourceware to Gerrit sync (Code Review) @ 2019-11-27 21:40 UTC (permalink / raw)
To: Christian Biesinger, Tom Tromey, gdb-patches
The original change was created by Christian Biesinger.
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/687
......................................................................
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
---
M gdb/ChangeLog
M gdb/maint.c
M gdb/maint.h
M gdb/minsyms.c
4 files changed, 33 insertions(+), 4 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 64c8ab5..3033cf6 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,15 @@
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.
+
+2019-11-27 Christian Biesinger <cbiesinger@google.com>
+
* minsyms.c (add_minsym_to_hash_table): Use a previously computed
hash code if possible.
(add_minsym_to_demangled_hash_table): Likewise.
diff --git a/gdb/maint.c b/gdb/maint.c
index 7ab3fdb..dbc949a 100644
--- a/gdb/maint.c
+++ b/gdb/maint.c
@@ -845,7 +845,12 @@
}
#endif
-static int n_worker_threads = -1;
+static int n_worker_threads = 0;
+
+bool worker_threads_disabled ()
+{
+ return n_worker_threads == 0;
+}
/* Update the thread pool for the desired number of threads. */
static void
diff --git a/gdb/maint.h b/gdb/maint.h
index 827964d..cbaf9de 100644
--- a/gdb/maint.h
+++ b/gdb/maint.h
@@ -26,6 +26,8 @@
extern void set_per_command_space (int);
+extern bool worker_threads_disabled ();
+
/* Records a run time and space usage to be used as a base for
reporting elapsed time or change in space. */
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 @@
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 @@
(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
--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I92ba4f6bbf07363189666327cad452d6b9c8e01d
Gerrit-Change-Number: 687
Gerrit-PatchSet: 3
Gerrit-Owner: Christian Biesinger <cbiesinger@google.com>
Gerrit-Reviewer: Christian Biesinger <cbiesinger@google.com>
Gerrit-Reviewer: Tom Tromey <tromey@sourceware.org>
Gerrit-MessageType: newpatchset
^ permalink raw reply [flat|nested] 7+ messages in thread
* [pushed] Turn off threaded minsym demangling by default
2019-11-19 3:00 [review] Turn off threaded minsym demangling by default Christian Biesinger (Code Review)
` (3 preceding siblings ...)
2019-11-26 21:55 ` Tom Tromey (Code Review)
@ 2019-11-27 21:40 ` Sourceware to Gerrit sync (Code Review)
2019-11-27 21:40 ` Sourceware to Gerrit sync (Code Review)
5 siblings, 0 replies; 7+ messages in thread
From: Sourceware to Gerrit sync (Code Review) @ 2019-11-27 21:40 UTC (permalink / raw)
To: Christian Biesinger, gdb-patches; +Cc: Tom Tromey
Sourceware to Gerrit sync has submitted this change.
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/687
......................................................................
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
---
M gdb/ChangeLog
M gdb/maint.c
M gdb/maint.h
M gdb/minsyms.c
4 files changed, 33 insertions(+), 4 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 64c8ab5..3033cf6 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,15 @@
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.
+
+2019-11-27 Christian Biesinger <cbiesinger@google.com>
+
* minsyms.c (add_minsym_to_hash_table): Use a previously computed
hash code if possible.
(add_minsym_to_demangled_hash_table): Likewise.
diff --git a/gdb/maint.c b/gdb/maint.c
index 7ab3fdb..dbc949a 100644
--- a/gdb/maint.c
+++ b/gdb/maint.c
@@ -845,7 +845,12 @@
}
#endif
-static int n_worker_threads = -1;
+static int n_worker_threads = 0;
+
+bool worker_threads_disabled ()
+{
+ return n_worker_threads == 0;
+}
/* Update the thread pool for the desired number of threads. */
static void
diff --git a/gdb/maint.h b/gdb/maint.h
index 827964d..cbaf9de 100644
--- a/gdb/maint.h
+++ b/gdb/maint.h
@@ -26,6 +26,8 @@
extern void set_per_command_space (int);
+extern bool worker_threads_disabled ();
+
/* Records a run time and space usage to be used as a base for
reporting elapsed time or change in space. */
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 @@
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 @@
(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
--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I92ba4f6bbf07363189666327cad452d6b9c8e01d
Gerrit-Change-Number: 687
Gerrit-PatchSet: 3
Gerrit-Owner: Christian Biesinger <cbiesinger@google.com>
Gerrit-Reviewer: Christian Biesinger <cbiesinger@google.com>
Gerrit-Reviewer: Tom Tromey <tromey@sourceware.org>
Gerrit-MessageType: merged
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2019-11-27 21:40 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-19 3:00 [review] Turn off threaded minsym demangling by default Christian Biesinger (Code Review)
2019-11-19 21:54 ` Christian Biesinger (Code Review)
2019-11-22 23:48 ` Tom Tromey (Code Review)
2019-11-26 21:53 ` [review v2] " Christian Biesinger (Code Review)
2019-11-26 21:55 ` Tom Tromey (Code Review)
2019-11-27 21:40 ` [pushed] " Sourceware to Gerrit sync (Code Review)
2019-11-27 21:40 ` Sourceware to Gerrit sync (Code Review)
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).