[v2,8/8] Add maint set/show enable-threads
Commit Message
This adds maint commands to control whether gdb is able to use
threads.
gdb/ChangeLog
2019-05-18 Tom Tromey <tom@tromey.com>
* NEWS: Add entry.
* maint.c (_initialize_maint_cmds): Add "enable-threads" maint
commands.
gdb/doc/ChangeLog
2019-05-18 Tom Tromey <tom@tromey.com>
* gdb.texinfo (Maintenance Commands): Document new maint
commands.
---
gdb/ChangeLog | 6 ++++++
gdb/NEWS | 4 ++++
gdb/doc/ChangeLog | 5 +++++
gdb/doc/gdb.texinfo | 11 +++++++++++
gdb/maint.c | 10 ++++++++++
5 files changed, 36 insertions(+)
Comments
> From: Tom Tromey <tom@tromey.com>
> Cc: Tom Tromey <tom@tromey.com>
> Date: Sat, 18 May 2019 15:00:10 -0600
>
> This adds maint commands to control whether gdb is able to use
> threads.
>
> gdb/ChangeLog
> 2019-05-18 Tom Tromey <tom@tromey.com>
>
> * NEWS: Add entry.
> * maint.c (_initialize_maint_cmds): Add "enable-threads" maint
> commands.
>
> gdb/doc/ChangeLog
> 2019-05-18 Tom Tromey <tom@tromey.com>
>
> * gdb.texinfo (Maintenance Commands): Document new maint
> commands.
Thanks.
> +maint set enable-threads
> +maint show enable-threads
> + Control whether GDB can use threads. The default is "on".
I'd suggest to say what will threads be used for.
> + add_setshow_boolean_cmd ("enable-threads", class_maintenance,
> + &gdb::enable_threads, _("\
> +Set whether gdb can use multiple threads."), _("\
> +Show whether gdb can use multiple threads."), _("\
> +If enabled, gdb will use multiple threads when possible."),
maybe also here.
The documentation parts are OK with this nit fixed.
>> +maint set enable-threads
>> +maint show enable-threads
>> + Control whether GDB can use threads. The default is "on".
Eli> I'd suggest to say what will threads be used for.
In NEWS I guess it's ok, but elsewhere I'd prefer to be a bit vague
about the precise use of threads. That way the documentation won't go
stale if we add more uses.
Tom
> From: Tom Tromey <tom@tromey.com>
> Cc: Tom Tromey <tom@tromey.com>, gdb-patches@sourceware.org
> Date: Sun, 26 May 2019 14:46:12 -0600
>
> >> +maint set enable-threads
> >> +maint show enable-threads
> >> + Control whether GDB can use threads. The default is "on".
>
> Eli> I'd suggest to say what will threads be used for.
>
> In NEWS I guess it's ok, but elsewhere I'd prefer to be a bit vague
> about the precise use of threads. That way the documentation won't go
> stale if we add more uses.
That's okay, we can be vague. How about saying that "threads are used
for some CPU-extensive processing, such as ..." and give one example?
My point is that leaving it entirely unsaid is way too vague,
especially for readers who might be debugging programs that themselves
use threads.
@@ -46,6 +46,10 @@ show print max-depth
The default max-depth is 20, but this can be set to unlimited to get
the old behavior back.
+maint set enable-threads
+maint show enable-threads
+ Control whether GDB can use threads. The default is "on".
+
* New MI commands
-complete
@@ -36925,6 +36925,17 @@ 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 enable-threads
+@kindex maint show enable-threads
+@item maint set enable-threads
+@item maint show enable-threads
+Control whether @value{GDBN} uses threads. On capable hosts,
+@value{GDBN} will use multiple threads to speed up certain operations.
+However, when debugging @value{GDBN} itself, it is sometimes
+convenient to disable this feature. That can be done using this
+command. The default is @samp{on}.
+
@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,13 @@ When enabled GDB is profiled."),
show_maintenance_profile_p,
&maintenance_set_cmdlist,
&maintenance_show_cmdlist);
+
+ add_setshow_boolean_cmd ("enable-threads", class_maintenance,
+ &gdb::enable_threads, _("\
+Set whether gdb can use multiple threads."), _("\
+Show whether gdb can use multiple threads."), _("\
+If enabled, gdb will use multiple threads when possible."),
+ NULL, NULL,
+ &maintenance_set_cmdlist,
+ &maintenance_show_cmdlist);
}