aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2019-03-16 14:36:57 -0600
committerTom Tromey <tom@tromey.com>2019-10-01 13:38:26 -0600
commit792581b91e2dba4401645db9b57160ef9c2d1d04 (patch)
tree43a5397fa25a040ef07250747ef87590ae1e1b56
parentcec2f67ef73d024dddbdf85e3546d1cf13014e68 (diff)
downloadgdb-792581b91e2dba4401645db9b57160ef9c2d1d04.zip
gdb-792581b91e2dba4401645db9b57160ef9c2d1d04.tar.gz
gdb-792581b91e2dba4401645db9b57160ef9c2d1d04.tar.bz2
Add maint set/show max-worker-threads
This adds maint commands to control the maximum number of worker threads that gdb can use. 2019-09-30 Tom Tromey <tom@tromey.com> * NEWS: Add entry. * maint.c (_initialize_maint_cmds): Add "max-worker-threads" maint commands. gdb/doc/ChangeLog 2019-09-30 Tom Tromey <tom@tromey.com> * gdb.texinfo (Maintenance Commands): Document new maint commands.
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/NEWS6
-rw-r--r--gdb/doc/ChangeLog5
-rw-r--r--gdb/doc/gdb.texinfo14
-rw-r--r--gdb/maint.c12
5 files changed, 43 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index e2b91c6..d7407a3 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
2019-09-30 Tom Tromey <tom@tromey.com>
+ * NEWS: Add entry.
+ * maint.c (_initialize_maint_cmds): Add "max-worker-threads" maint
+ commands.
+
+2019-09-30 Tom Tromey <tom@tromey.com>
+
* minsyms.c (minimal_symbol_reader::install): Use
parallel_for_each.
* gdbsupport/parallel-for.h: New file.
diff --git a/gdb/NEWS b/gdb/NEWS
index 779fd91..7d4988f 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -122,6 +122,12 @@ set style highlight background COLOR
set style highlight intensity VALUE
Control the styling of highlightings.
+maint set max-worker-threads
+maint show max-worker-threads
+ Control the maximum number of worker threads that can be used by GDB.
+ The default is "unlimited". Currently worker threads are only used when
+ demangling the names of linker symbols.
+
maint set test-settings KIND
maint show test-settings KIND
A set of commands used by the testsuite for exercising the settings
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index 0a10fa3..eef81f0 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,3 +1,8 @@
+2019-09-30 Tom Tromey <tom@tromey.com>
+
+ * gdb.texinfo (Maintenance Commands): Document new maint
+ commands.
+
2019-09-20 Ulrich Weigand <uweigand@de.ibm.com>
* doc/gdb.texinfo (Remote Configuration): Remove documentation for
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index f2713c0..04a4009 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -37663,6 +37663,20 @@ with the DWARF frame unwinders enabled.
If DWARF frame unwinders are not supported for a particular target
architecture, then enabling this flag does not cause them to be used.
+
+@kindex maint set max-worker-threads
+@kindex maint show max-worker-threads
+@item maint set max-worker-threads
+@item maint show max-worker-threads
+Control the number of worker threads that may be used by @value{GDBN}.
+On capable hosts, @value{GDBN} may use multiple threads to speed up
+certain CPU-intensive operations, such as demangling symbol names.
+While the number of threads used by @value{GDBN} may vary, this
+command can be used to set an upper bound on this number. The default
+is @code{unlimited}. Note that this only controls worker threads
+started by @value{GDBN} itself; libraries used by @value{GDBN} may
+start threads of their own.
+
@kindex maint set profile
@kindex maint show profile
@cindex profiling GDB
diff --git a/gdb/maint.c b/gdb/maint.c
index ec9f4ab..8428bea 100644
--- a/gdb/maint.c
+++ b/gdb/maint.c
@@ -40,6 +40,7 @@
#include "top.h"
#include "maint.h"
#include "gdbsupport/selftest.h"
+#include "gdbsupport/parallel-for.h"
#include "cli/cli-decode.h"
#include "cli/cli-utils.h"
@@ -1312,4 +1313,15 @@ When enabled GDB is profiled."),
show_maintenance_profile_p,
&maintenance_set_cmdlist,
&maintenance_show_cmdlist);
+
+ add_setshow_zuinteger_unlimited_cmd ("max-worker-threads",
+ class_maintenance,
+ &gdb::max_threads, _("\
+Set the maximum number of worker threads GDB can use."), _("\
+Set the maximum number of worker threads GDB can use."), _("\
+GDB may use multiple threads to speed up certain CPU-intensive operations,\n\
+such as demangling symbol names."),
+ NULL, NULL,
+ &maintenance_set_cmdlist,
+ &maintenance_show_cmdlist);
}