[v3,8/8] Add maint set/show max-worker-threads
Commit Message
This adds maint commands to control the maximum number of worker
threads that gdb can use.
gdb/ChangeLog
2019-05-29 Tom Tromey <tom@tromey.com>
* NEWS: Add entry.
* maint.c (_initialize_maint_cmds): Add "max-worker-threads" maint
commands.
gdb/doc/ChangeLog
2019-05-29 Tom Tromey <tom@tromey.com>
* gdb.texinfo (Maintenance Commands): Document new maint
commands.
---
gdb/ChangeLog | 6 ++++++
gdb/NEWS | 6 ++++++
gdb/doc/ChangeLog | 5 +++++
gdb/doc/gdb.texinfo | 14 ++++++++++++++
gdb/maint.c | 12 ++++++++++++
5 files changed, 43 insertions(+)
Comments
> From: Tom Tromey <tom@tromey.com>
> Cc: Tom Tromey <tom@tromey.com>
> Date: Wed, 29 May 2019 15:29:16 -0600
>
> This adds maint commands to control the maximum number of worker
> threads that gdb can use.
>
> gdb/ChangeLog
> 2019-05-29 Tom Tromey <tom@tromey.com>
>
> * NEWS: Add entry.
> * maint.c (_initialize_maint_cmds): Add "max-worker-threads" maint
> commands.
>
> gdb/doc/ChangeLog
> 2019-05-29 Tom Tromey <tom@tromey.com>
>
> * gdb.texinfo (Maintenance Commands): Document new maint
> commands.
Thanks, this is OK.
On 5/29/19 10:29 PM, Tom Tromey wrote:
> * maint.c (_initialize_maint_cmds): Add "max-worker-threads" maint
> commands.
LGTM.
Thanks,
Pedro Alves
@@ -50,6 +50,12 @@ set logging debugredirect [on|off]
By default, GDB debug output will go to both the terminal and the logfile.
Set if you want debug output to go only to the log file.
+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.
+
* New MI commands
-complete
@@ -36928,6 +36928,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
@@ -39,6 +39,7 @@
#include "top.h"
#include "maint.h"
#include "common/selftest.h"
+#include "common/parallel-for.h"
#include "cli/cli-decode.h"
#include "cli/cli-utils.h"
@@ -1143,4 +1144,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);
}