Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [PATCH v3 8/8] Add maint set/show max-worker-threads
Date: Wed, 29 May 2019 21:29:00 -0000	[thread overview]
Message-ID: <20190529212916.23721-9-tom@tromey.com> (raw)
In-Reply-To: <20190529212916.23721-1-tom@tromey.com>

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(+)

diff --git a/gdb/NEWS b/gdb/NEWS
index 6546b7243a9..84b2ea52cec 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -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
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 3c4535ec506..ccbb770a027 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -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
diff --git a/gdb/maint.c b/gdb/maint.c
index 328d6026a34..cb52d323795 100644
--- a/gdb/maint.c
+++ b/gdb/maint.c
@@ -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);
 }
-- 
2.17.2


  parent reply	other threads:[~2019-05-29 21:29 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-29 21:29 [PATCH v3 0/8] Demangle minimal symbol names in worker threads Tom Tromey
2019-05-29 21:29 ` [PATCH v3 7/8] Demangle minsyms in parallel Tom Tromey
2019-05-30 14:19   ` Pedro Alves
2019-05-30 22:22     ` Tom Tromey
2019-05-29 21:29 ` [PATCH v3 3/8] Add configure check for std::thread Tom Tromey
2019-05-30 11:34   ` Pedro Alves
2019-05-29 21:29 ` [PATCH v3 1/8] Defer minimal symbol name-setting Tom Tromey
2019-05-29 21:29 ` Tom Tromey [this message]
2019-05-30  2:36   ` [PATCH v3 8/8] Add maint set/show max-worker-threads Eli Zaretskii
2019-05-30 14:20   ` Pedro Alves
2019-05-29 21:29 ` [PATCH v3 5/8] Introduce run_on_main_thread Tom Tromey
2019-05-30 13:12   ` Pedro Alves
2019-05-30 13:20     ` Tom Tromey
2019-05-30 13:57       ` Pedro Alves
2019-05-30 14:01       ` Pedro Alves
2019-05-29 21:29 ` [PATCH v3 2/8] Remove static buffer from ada_decode Tom Tromey
2019-05-30  0:08   ` Pedro Alves
2019-05-29 21:29 ` [PATCH v3 4/8] Lock the demangled hash table Tom Tromey
2019-05-30 12:58   ` Pedro Alves
2019-05-30 14:03     ` Pedro Alves
2019-05-30 21:58     ` Tom Tromey
2019-05-29 22:03 ` [PATCH v3 6/8] Introduce thread-safe way to handle SIGSEGV Tom Tromey
2019-05-30 13:40   ` Pedro Alves
2019-06-09 15:43     ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190529212916.23721-9-tom@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox