2011-07-26 Philippe Waroquiers <philippe.waroquiers@skynet.be>
authorPhilippe Waroquiers <philippe@sourceware.org>
Tue, 26 Jul 2011 20:57:54 +0000 (20:57 +0000)
committerPhilippe Waroquiers <philippe@sourceware.org>
Tue, 26 Jul 2011 20:57:54 +0000 (20:57 +0000)
* remote.c (remote_region_ok_for_hw_watchpoint): New function.
(remote_hw_watchpoint_length_limit): New variable.
(_initialize_remote) add set,show cmds for this new variable.
* gdb.texinfo: document these new commands.
* NEWS: Mention these new commands.

gdb/ChangeLog
gdb/NEWS
gdb/doc/gdb.texinfo
gdb/remote.c

index 96f527b4e4d80383724549206f2cb23a8822e288..a6b5e94a6792a680a314b4eba29bc36cb7af3d24 100644 (file)
@@ -1,3 +1,11 @@
+2011-07-26  Philippe Waroquiers  <philippe.waroquiers@skynet.be>
+
+       * remote.c (remote_region_ok_for_hw_watchpoint): New function.
+       (remote_hw_watchpoint_length_limit): New variable.
+       (_initialize_remote) add set,show cmds for this new variable.
+       * gdb.texinfo: document these new commands.
+       * NEWS: Mention these new commands.
+
 2011-07-26  Pedro Alves  <pedro@codesourcery.com>
 
        * breakpoint.c (works_in_software_mode_watchpoint): Also return
index f1c255cfff4004a21a33c2b48f737213ade09ea4..b0da564c36bde288a7d8c1887275bcdeb097867c 100644 (file)
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -3,6 +3,16 @@
 
 *** Changes since GDB 7.3
 
+* GDB has two new commands: "set remote hardware-watchpoint-length-limit"
+  and "show remote hardware-watchpoint-length-limit".  These allows to
+  set or show the maximum length limit (in bytes) of a remote
+  target hardware watchpoint.
+
+  This allows e.g. to use "unlimited" hardware watchpoints with the
+  gdbserver integrated in Valgrind version >= 3.7.0.  Such Valgrind
+  watchpoints are slower than real hardware watchpoints but are
+  significantly faster than gdb software watchpoints.
+
 * Python scripting
 
   ** The "maint set python print-stack on|off" command has been
index 600ad720e7235e5fd0fee0b54cd97c5363345bb6..35fa075d775880d9fb3cba6c88390b7e914e7781 100644 (file)
@@ -16655,6 +16655,18 @@ responses.
 Restrict @value{GDBN} to using @var{limit} remote hardware breakpoint or
 watchpoints.  A limit of -1, the default, is treated as unlimited.
 
+@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.
+
+@item show remote hardware-watchpoint-length-limit
+Show the current limit (in bytes) of the maximum length of
+a remote hardware watchpoint.
+
 @item set remote exec-file @var{filename}
 @itemx show remote exec-file
 @anchor{set remote exec-file}
index e7e417f0b2be669e83690823ffe5e4a9ba83ec49..b17cb50b92dd8d5078bcdedc9efcfe7041f40833 100644 (file)
@@ -7763,8 +7763,22 @@ remote_remove_watchpoint (CORE_ADDR addr, int len, int type,
 
 
 int remote_hw_watchpoint_limit = -1;
+int remote_hw_watchpoint_length_limit = -1;
 int remote_hw_breakpoint_limit = -1;
 
+static int
+remote_region_ok_for_hw_watchpoint (CORE_ADDR addr, int len)
+{
+  if (remote_hw_watchpoint_length_limit == 0)
+    return 0;
+  else if (remote_hw_watchpoint_length_limit < 0)
+    return 1;
+  else if (len <= remote_hw_watchpoint_length_limit)
+    return 1;
+  else
+    return 0;
+}
+
 static int
 remote_check_watch_resources (int type, int cnt, int ot)
 {
@@ -10356,6 +10370,8 @@ Specify the serial device it is connected to\n\
   remote_ops.to_can_use_hw_breakpoint = remote_check_watch_resources;
   remote_ops.to_insert_hw_breakpoint = remote_insert_hw_breakpoint;
   remote_ops.to_remove_hw_breakpoint = remote_remove_hw_breakpoint;
+  remote_ops.to_region_ok_for_hw_watchpoint
+     = remote_region_ok_for_hw_watchpoint;
   remote_ops.to_insert_watchpoint = remote_insert_watchpoint;
   remote_ops.to_remove_watchpoint = remote_remove_watchpoint;
   remote_ops.to_kill = remote_kill;
@@ -10751,6 +10767,15 @@ Specify a negative limit for unlimited."),
                                           number of target hardware
                                           watchpoints is %s.  */
                            &remote_set_cmdlist, &remote_show_cmdlist);
+  add_setshow_zinteger_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.  */
+                           &remote_set_cmdlist, &remote_show_cmdlist);
   add_setshow_zinteger_cmd ("hardware-breakpoint-limit", no_class,
                            &remote_hw_breakpoint_limit, _("\
 Set the maximum number of target hardware breakpoints."), _("\
This page took 0.058416 seconds and 4 git commands to generate.