* [PATCH] gdb: Use add_setshow_zuinteger_unlimited_cmd in remote.c
@ 2018-07-02 22:11 Andrew Burgess
2018-07-04 16:46 ` Eli Zaretskii
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Andrew Burgess @ 2018-07-02 22:11 UTC (permalink / raw)
To: gdb-patches; +Cc: Andrew Burgess
Not sure if this requires a NEWS entry given the small change in
acceptable command arguments.
---
Switch to use add_setshow_zuinteger_unlimited_cmd for some of the
control variables in remote.c. The variables
hardware-watchpoint-limit, hardware-breakpoint-limit, and
hardware-watchpoint-length-limit are all changed. For example, a user
will now see this:
(gdb) show remote hardware-breakpoint-limit
The maximum number of target hardware breakpoints is unlimited.
Instead of this:
(gdb) show remote hardware-breakpoint-limit
The maximum number of target hardware breakpoints is -1.
And can do this:
(gdb) set remote hardware-breakpoint-limit unlimited
However, previously any negative value implied "unlimited", now only
-1, or the text "unlimited" can be used for unlimited. Any other
negative value will give an error about invalid input. This is a
small change in the user interface, but, hopefully, this will not
cause too many problems.
I've also added show functions for these three variables to allow for
internationalisation.
gdb/ChangeLog:
* remote.c (show_hardware_watchpoint_limit): New function.
(show_hardware_watchpoint_length_limit): New function.
(show_hardware_breakpoint_limit): New function.
(_initialize_remote): Use add_setshow_zuinteger_unlimited_cmd
where appropriate, update help text.
gdb/doc/ChangeLog:
* gdb.texinfo (Remote Configuration): Update descriptions for
set/show of hardware-watchpoint-limit, hardware-breakpoint-limit,
and hardware-watchpoint-length-limit variables.
---
gdb/ChangeLog | 8 ++++++++
gdb/doc/ChangeLog | 6 ++++++
gdb/doc/gdb.texinfo | 18 ++++++++++++-----
gdb/remote.c | 58 ++++++++++++++++++++++++++++++++++++++---------------
4 files changed, 69 insertions(+), 21 deletions(-)
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 7fb6ac56364..e3937045593 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -21161,16 +21161,24 @@
@anchor{set remote hardware-breakpoint-limit}
@item set remote hardware-watchpoint-limit @var{limit}
@itemx set remote hardware-breakpoint-limit @var{limit}
-Restrict @value{GDBN} to using @var{limit} remote hardware breakpoint or
-watchpoints. A limit of -1, the default, is treated as unlimited.
+Restrict @value{GDBN} to using @var{limit} remote hardware watchpoints
+or breakpoints. The @var{limit} can be set to 0 to disable hardware
+watchpoints or breakpoints, and @code{unilmited} for unlimited
+watchpoints or breakpoints.
+
+@item show remote hardware-watchpoint-limit
+@itemx show remote hardware-breakpoint-limit
+Show the current limit for the number of hardware watchpoints or
+breakpoints that @value{GDBN} can use.
@cindex limit hardware watchpoints length
@cindex remote target, limit watchpoints length
@anchor{set remote hardware-watchpoint-length-limit}
@item set remote hardware-watchpoint-length-limit @var{limit}
-Restrict @value{GDBN} to using @var{limit} bytes for the maximum length of
-a remote hardware watchpoint. A limit of -1, the default, is treated
-as unlimited.
+Restrict @value{GDBN} to using @var{limit} bytes for the maximum
+length of a remote hardware watchpoint. A @var{limit} of 0 disables
+hardware watchpoints and @code{unlimited} allows watchpoints of any
+length.
@item show remote hardware-watchpoint-length-limit
Show the current limit (in bytes) of the maximum length of
diff --git a/gdb/remote.c b/gdb/remote.c
index f88e801dbef..90492f58902 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -1728,6 +1728,36 @@ show_memory_write_packet_size (const char *args, int from_tty)
show_memory_packet_size (&memory_write_packet_config);
}
+/* Show the number of hardware watchpoints that can be used. */
+
+static void
+show_hardware_watchpoint_limit (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c, const char *value)
+{
+ fprintf_filtered (file, _("The maximum number of target hardware "
+ "watchpoints is %s.\n"), value);
+}
+
+/* Show the length limit (in bytes) for hardware watchpoints. */
+
+static void
+show_hardware_watchpoint_length_limit (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c, const char *value)
+{
+ fprintf_filtered (file, _("The maximum length (in bytes) of a target "
+ "hardware watchpoint is %s.\n"), value);
+}
+
+/* Show the number of hardware breakpoints that can be used. */
+
+static void
+show_hardware_breakpoint_limit (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c, const char *value)
+{
+ fprintf_filtered (file, _("The maximum number of target hardware "
+ "breakpoints is %s.\n"), value);
+}
+
long
remote_target::get_memory_write_packet_size ()
{
@@ -14347,32 +14377,28 @@ further restriction and ``limit'' to enable that restriction."),
_("Show the maximum number of bytes per memory-read packet."),
&remote_show_cmdlist);
- add_setshow_zinteger_cmd ("hardware-watchpoint-limit", no_class,
+ add_setshow_zuinteger_unlimited_cmd ("hardware-watchpoint-limit", no_class,
&remote_hw_watchpoint_limit, _("\
Set the maximum number of target hardware watchpoints."), _("\
Show the maximum number of target hardware watchpoints."), _("\
-Specify a negative limit for unlimited."),
- NULL, NULL, /* FIXME: i18n: The maximum
- number of target hardware
- watchpoints is %s. */
- &remote_set_cmdlist, &remote_show_cmdlist);
- add_setshow_zinteger_cmd ("hardware-watchpoint-length-limit", no_class,
+Specify \"unlimited\" for unlimited hardware watchpoints."),
+ NULL, show_hardware_watchpoint_limit,
+ &remote_set_cmdlist,
+ &remote_show_cmdlist);
+ add_setshow_zuinteger_unlimited_cmd ("hardware-watchpoint-length-limit",
+ no_class,
&remote_hw_watchpoint_length_limit, _("\
Set the maximum length (in bytes) of a target hardware watchpoint."), _("\
Show the maximum length (in bytes) of a target hardware watchpoint."), _("\
-Specify a negative limit for unlimited."),
- NULL, NULL, /* FIXME: i18n: The maximum
- length (in bytes) of a target
- hardware watchpoint is %s. */
+Specify \"unlimited\" to allow unlimited sized watchpoints."),
+ NULL, show_hardware_watchpoint_length_limit,
&remote_set_cmdlist, &remote_show_cmdlist);
- add_setshow_zinteger_cmd ("hardware-breakpoint-limit", no_class,
+ add_setshow_zuinteger_unlimited_cmd ("hardware-breakpoint-limit", no_class,
&remote_hw_breakpoint_limit, _("\
Set the maximum number of target hardware breakpoints."), _("\
Show the maximum number of target hardware breakpoints."), _("\
-Specify a negative limit for unlimited."),
- NULL, NULL, /* FIXME: i18n: The maximum
- number of target hardware
- breakpoints is %s. */
+Specify \"unlimited\" for unlimited hardware breakpoints."),
+ NULL, show_hardware_breakpoint_limit,
&remote_set_cmdlist, &remote_show_cmdlist);
add_setshow_zuinteger_cmd ("remoteaddresssize", class_obscure,
--
2.14.4
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] gdb: Use add_setshow_zuinteger_unlimited_cmd in remote.c
2018-07-02 22:11 [PATCH] gdb: Use add_setshow_zuinteger_unlimited_cmd in remote.c Andrew Burgess
@ 2018-07-04 16:46 ` Eli Zaretskii
2018-07-07 2:01 ` Simon Marchi
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2018-07-04 16:46 UTC (permalink / raw)
To: Andrew Burgess; +Cc: gdb-patches
> From: Andrew Burgess <andrew.burgess@embecosm.com>
> Cc: Andrew Burgess <andrew.burgess@embecosm.com>
> Date: Mon, 2 Jul 2018 23:11:46 +0100
>
> Not sure if this requires a NEWS entry given the small change in
> acceptable command arguments.
I don't think we need a NEWS entry for this.
> gdb/doc/ChangeLog:
>
> * gdb.texinfo (Remote Configuration): Update descriptions for
> set/show of hardware-watchpoint-limit, hardware-breakpoint-limit,
> and hardware-watchpoint-length-limit variables.
The documentation parts are approved.
Thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] gdb: Use add_setshow_zuinteger_unlimited_cmd in remote.c
2018-07-02 22:11 [PATCH] gdb: Use add_setshow_zuinteger_unlimited_cmd in remote.c Andrew Burgess
2018-07-04 16:46 ` Eli Zaretskii
@ 2018-07-07 2:01 ` Simon Marchi
2018-07-09 15:11 ` Pedro Alves
2018-07-09 17:10 ` Andrew Burgess
3 siblings, 0 replies; 5+ messages in thread
From: Simon Marchi @ 2018-07-07 2:01 UTC (permalink / raw)
To: Andrew Burgess, gdb-patches
On 2018-07-02 06:11 PM, Andrew Burgess wrote:
> @@ -1728,6 +1728,36 @@ show_memory_write_packet_size (const char *args, int from_tty)
> show_memory_packet_size (&memory_write_packet_config);
> }
>
> +/* Show the number of hardware watchpoints that can be used. */
> +
> +static void
> +show_hardware_watchpoint_limit (struct ui_file *file, int from_tty,
> + struct cmd_list_element *c, const char *value)
> +{
> + fprintf_filtered (file, _("The maximum number of target hardware "
> + "watchpoints is %s.\n"), value);
> +}
> +
> +/* Show the length limit (in bytes) for hardware watchpoints. */
> +
> +static void
> +show_hardware_watchpoint_length_limit (struct ui_file *file, int from_tty,
> + struct cmd_list_element *c, const char *value)
This line is too long. Otherwise, LGTM. Thanks!
Simon
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] gdb: Use add_setshow_zuinteger_unlimited_cmd in remote.c
2018-07-02 22:11 [PATCH] gdb: Use add_setshow_zuinteger_unlimited_cmd in remote.c Andrew Burgess
2018-07-04 16:46 ` Eli Zaretskii
2018-07-07 2:01 ` Simon Marchi
@ 2018-07-09 15:11 ` Pedro Alves
2018-07-09 17:10 ` Andrew Burgess
3 siblings, 0 replies; 5+ messages in thread
From: Pedro Alves @ 2018-07-09 15:11 UTC (permalink / raw)
To: Andrew Burgess, gdb-patches
Hi Andrew,
Noticed a typo below.
On 07/02/2018 11:11 PM, Andrew Burgess wrote:
> @@ -21161,16 +21161,24 @@
> @anchor{set remote hardware-breakpoint-limit}
> @item set remote hardware-watchpoint-limit @var{limit}
> @itemx set remote hardware-breakpoint-limit @var{limit}
> -Restrict @value{GDBN} to using @var{limit} remote hardware breakpoint or
> -watchpoints. A limit of -1, the default, is treated as unlimited.
> +Restrict @value{GDBN} to using @var{limit} remote hardware watchpoints
> +or breakpoints. The @var{limit} can be set to 0 to disable hardware
> +watchpoints or breakpoints, and @code{unilmited} for unlimited
> +watchpoints or breakpoints.
Typo:
"unilmited" -> unlimited
> Set the maximum length (in bytes) of a target hardware watchpoint."), _("\
> Show the maximum length (in bytes) of a target hardware watchpoint."), _("\
> -Specify a negative limit for unlimited."),
> - NULL, NULL, /* FIXME: i18n: The maximum
> - length (in bytes) of a target
> - hardware watchpoint is %s. */
> +Specify \"unlimited\" to allow unlimited sized watchpoints."),
While at it, a nit, shouldn't "unlimited sized" be hyphenated,
being a compound adjective:
unlimited-sized watchpoints.
(in contrast with allowing an unlimited number of
"sized watchpoints", whatever that would be.)
Maybe this would be clearest:
Specify \"unlimited\" to allow watchpoints of unlimited size."
Thanks,
Pedro Alves
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] gdb: Use add_setshow_zuinteger_unlimited_cmd in remote.c
2018-07-02 22:11 [PATCH] gdb: Use add_setshow_zuinteger_unlimited_cmd in remote.c Andrew Burgess
` (2 preceding siblings ...)
2018-07-09 15:11 ` Pedro Alves
@ 2018-07-09 17:10 ` Andrew Burgess
3 siblings, 0 replies; 5+ messages in thread
From: Andrew Burgess @ 2018-07-09 17:10 UTC (permalink / raw)
To: gdb-patches
Thanks for all the feedback, here's the final version I pushed:
--
[PATCH] gdb: Use add_setshow_zuinteger_unlimited_cmd in remote.c
Switch to use add_setshow_zuinteger_unlimited_cmd for some of the
control variables in remote.c. The variables
hardware-watchpoint-limit, hardware-breakpoint-limit, and
hardware-watchpoint-length-limit are all changed. For example, a user
will now see this:
(gdb) show remote hardware-breakpoint-limit
The maximum number of target hardware breakpoints is unlimited.
Instead of this:
(gdb) show remote hardware-breakpoint-limit
The maximum number of target hardware breakpoints is -1.
And can do this:
(gdb) set remote hardware-breakpoint-limit unlimited
However, previously any negative value implied "unlimited", now only
-1, or the text "unlimited" can be used for unlimited. Any other
negative value will give an error about invalid input. This is a
small change in the user interface, but, hopefully, this will not
cause too many problems.
I've also added show functions for these three variables to allow for
internationalisation.
gdb/ChangeLog:
* remote.c (show_hardware_watchpoint_limit): New function.
(show_hardware_watchpoint_length_limit): New function.
(show_hardware_breakpoint_limit): New function.
(_initialize_remote): Use add_setshow_zuinteger_unlimited_cmd
where appropriate, update help text.
gdb/doc/ChangeLog:
* gdb.texinfo (Remote Configuration): Update descriptions for
set/show of hardware-watchpoint-limit, hardware-breakpoint-limit,
and hardware-watchpoint-length-limit variables.
---
gdb/ChangeLog | 8 +++++++
gdb/doc/ChangeLog | 6 ++++++
gdb/doc/gdb.texinfo | 18 +++++++++++-----
gdb/remote.c | 61 +++++++++++++++++++++++++++++++++++++++--------------
4 files changed, 72 insertions(+), 21 deletions(-)
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 91ec2199580..245d3f1b973 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -21161,16 +21161,24 @@
@anchor{set remote hardware-breakpoint-limit}
@item set remote hardware-watchpoint-limit @var{limit}
@itemx set remote hardware-breakpoint-limit @var{limit}
-Restrict @value{GDBN} to using @var{limit} remote hardware breakpoint or
-watchpoints. A limit of -1, the default, is treated as unlimited.
+Restrict @value{GDBN} to using @var{limit} remote hardware watchpoints
+or breakpoints. The @var{limit} can be set to 0 to disable hardware
+watchpoints or breakpoints, and @code{unlimited} for unlimited
+watchpoints or breakpoints.
+
+@item show remote hardware-watchpoint-limit
+@itemx show remote hardware-breakpoint-limit
+Show the current limit for the number of hardware watchpoints or
+breakpoints that @value{GDBN} can use.
@cindex limit hardware watchpoints length
@cindex remote target, limit watchpoints length
@anchor{set remote hardware-watchpoint-length-limit}
@item set remote hardware-watchpoint-length-limit @var{limit}
-Restrict @value{GDBN} to using @var{limit} bytes for the maximum length of
-a remote hardware watchpoint. A limit of -1, the default, is treated
-as unlimited.
+Restrict @value{GDBN} to using @var{limit} bytes for the maximum
+length of a remote hardware watchpoint. A @var{limit} of 0 disables
+hardware watchpoints and @code{unlimited} allows watchpoints of any
+length.
@item show remote hardware-watchpoint-length-limit
Show the current limit (in bytes) of the maximum length of
diff --git a/gdb/remote.c b/gdb/remote.c
index d5accc64c78..297c198ed69 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -1728,6 +1728,39 @@ show_memory_write_packet_size (const char *args, int from_tty)
show_memory_packet_size (&memory_write_packet_config);
}
+/* Show the number of hardware watchpoints that can be used. */
+
+static void
+show_hardware_watchpoint_limit (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c,
+ const char *value)
+{
+ fprintf_filtered (file, _("The maximum number of target hardware "
+ "watchpoints is %s.\n"), value);
+}
+
+/* Show the length limit (in bytes) for hardware watchpoints. */
+
+static void
+show_hardware_watchpoint_length_limit (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c,
+ const char *value)
+{
+ fprintf_filtered (file, _("The maximum length (in bytes) of a target "
+ "hardware watchpoint is %s.\n"), value);
+}
+
+/* Show the number of hardware breakpoints that can be used. */
+
+static void
+show_hardware_breakpoint_limit (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c,
+ const char *value)
+{
+ fprintf_filtered (file, _("The maximum number of target hardware "
+ "breakpoints is %s.\n"), value);
+}
+
long
remote_target::get_memory_write_packet_size ()
{
@@ -14347,32 +14380,28 @@ further restriction and ``limit'' to enable that restriction."),
_("Show the maximum number of bytes per memory-read packet."),
&remote_show_cmdlist);
- add_setshow_zinteger_cmd ("hardware-watchpoint-limit", no_class,
+ add_setshow_zuinteger_unlimited_cmd ("hardware-watchpoint-limit", no_class,
&remote_hw_watchpoint_limit, _("\
Set the maximum number of target hardware watchpoints."), _("\
Show the maximum number of target hardware watchpoints."), _("\
-Specify a negative limit for unlimited."),
- NULL, NULL, /* FIXME: i18n: The maximum
- number of target hardware
- watchpoints is %s. */
- &remote_set_cmdlist, &remote_show_cmdlist);
- add_setshow_zinteger_cmd ("hardware-watchpoint-length-limit", no_class,
+Specify \"unlimited\" for unlimited hardware watchpoints."),
+ NULL, show_hardware_watchpoint_limit,
+ &remote_set_cmdlist,
+ &remote_show_cmdlist);
+ add_setshow_zuinteger_unlimited_cmd ("hardware-watchpoint-length-limit",
+ no_class,
&remote_hw_watchpoint_length_limit, _("\
Set the maximum length (in bytes) of a target hardware watchpoint."), _("\
Show the maximum length (in bytes) of a target hardware watchpoint."), _("\
-Specify a negative limit for unlimited."),
- NULL, NULL, /* FIXME: i18n: The maximum
- length (in bytes) of a target
- hardware watchpoint is %s. */
+Specify \"unlimited\" to allow watchpoints of unlimited size."),
+ NULL, show_hardware_watchpoint_length_limit,
&remote_set_cmdlist, &remote_show_cmdlist);
- add_setshow_zinteger_cmd ("hardware-breakpoint-limit", no_class,
+ add_setshow_zuinteger_unlimited_cmd ("hardware-breakpoint-limit", no_class,
&remote_hw_breakpoint_limit, _("\
Set the maximum number of target hardware breakpoints."), _("\
Show the maximum number of target hardware breakpoints."), _("\
-Specify a negative limit for unlimited."),
- NULL, NULL, /* FIXME: i18n: The maximum
- number of target hardware
- breakpoints is %s. */
+Specify \"unlimited\" for unlimited hardware breakpoints."),
+ NULL, show_hardware_breakpoint_limit,
&remote_set_cmdlist, &remote_show_cmdlist);
add_setshow_zuinteger_cmd ("remoteaddresssize", class_obscure,
--
2.14.4
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-07-09 17:10 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-02 22:11 [PATCH] gdb: Use add_setshow_zuinteger_unlimited_cmd in remote.c Andrew Burgess
2018-07-04 16:46 ` Eli Zaretskii
2018-07-07 2:01 ` Simon Marchi
2018-07-09 15:11 ` Pedro Alves
2018-07-09 17:10 ` Andrew Burgess
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).