aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2021-08-28 20:38:27 -0600
committerTom Tromey <tom@tromey.com>2021-08-30 07:37:46 -0600
commitee8b88452c1cb1be97199942aee7a76bbca210ee (patch)
tree04eafb206446f7234971599e98b54a3a9a217004
parentf947f96797f8ec33aabf9cd7234c850778068445 (diff)
downloadgdb-ee8b88452c1cb1be97199942aee7a76bbca210ee.zip
gdb-ee8b88452c1cb1be97199942aee7a76bbca210ee.tar.gz
gdb-ee8b88452c1cb1be97199942aee7a76bbca210ee.tar.bz2
Add a show function for "maint show worker-threads"
I wanted to see how many threads gdb thought it was using, but "maint show worker-threads" only reported "unlimited". This patch adds a show function so that it will now report the number of threads gdb has started. Regression tested on x86-64 Fedora 34.
-rw-r--r--gdb/maint.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/gdb/maint.c b/gdb/maint.c
index 4637fcb..cbd7d4e 100644
--- a/gdb/maint.c
+++ b/gdb/maint.c
@@ -866,6 +866,21 @@ maintenance_set_worker_threads (const char *args, int from_tty,
update_thread_pool_size ();
}
+static void
+maintenance_show_worker_threads (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c,
+ const char *value)
+{
+ if (n_worker_threads == -1)
+ fprintf_filtered (file, _("The number of worker threads GDB "
+ "can use is unlimited (currently %zu).\n"),
+ gdb::thread_pool::g_thread_pool->thread_count ());
+ else
+ fprintf_filtered (file, _("The number of worker threads GDB "
+ "can use is %d.\n"),
+ n_worker_threads);
+}
+
/* If true, display time usage both at startup and for each command. */
@@ -1371,7 +1386,8 @@ Set the number of worker threads GDB can use."), _("\
Show the 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."),
- maintenance_set_worker_threads, NULL,
+ maintenance_set_worker_threads,
+ maintenance_show_worker_threads,
&maintenance_set_cmdlist,
&maintenance_show_cmdlist);