From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26092 invoked by alias); 26 Jul 2011 21:06:17 -0000 Received: (qmail 26083 invoked by uid 22791); 26 Jul 2011 21:06:15 -0000 X-SWARE-Spam-Status: No, hits=-0.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mailrelay005.isp.belgacom.be (HELO mailrelay005.isp.belgacom.be) (195.238.6.171) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 26 Jul 2011 21:06:00 +0000 X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApIBAAkqL05tgCPh/2dsb2JhbAAMWYETAjICFm8fhDfdP5EzgSuEBoEPBKNU Received: from 225.35-128-109.adsl-dyn.isp.belgacom.be (HELO [192.168.2.3]) ([109.128.35.225]) by relay.skynet.be with ESMTP; 26 Jul 2011 23:05:58 +0200 Subject: [commit] allow to set length for remote hw watchpoints (e.g. for Valgrind gdbserver) From: Philippe Waroquiers To: gdb-patches@sourceware.org Content-Type: text/plain; charset="UTF-8" Date: Tue, 26 Jul 2011 21:30:00 -0000 Message-ID: <1311714370.3213.8.camel@soleil> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-07/txt/msg00744.txt.bz2 After my addition in write after approval, and previous approval of this patch, committed the below. (regression tested in native and gdbserver on f12/x86, debian5/amd64, no regression identified). Thanks Index: gdb/ChangeLog =================================================================== RCS file: /cvs/src/src/gdb/ChangeLog,v retrieving revision 1.13227 diff -c -p -r1.13227 ChangeLog *** gdb/ChangeLog 26 Jul 2011 19:39:57 -0000 1.13227 --- gdb/ChangeLog 26 Jul 2011 20:50:58 -0000 *************** *** 1,3 **** --- 1,11 ---- + 2011-07-26 Philippe Waroquiers + + * 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 * breakpoint.c (works_in_software_mode_watchpoint): Also return Index: gdb/NEWS =================================================================== RCS file: /cvs/src/src/gdb/NEWS,v retrieving revision 1.445 diff -c -p -r1.445 NEWS *** gdb/NEWS 26 Jul 2011 15:24:02 -0000 1.445 --- gdb/NEWS 26 Jul 2011 20:51:00 -0000 *************** *** 3,8 **** --- 3,18 ---- *** 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: gdb/remote.c =================================================================== RCS file: /cvs/src/src/gdb/remote.c,v retrieving revision 1.458 diff -c -p -r1.458 remote.c *** gdb/remote.c 25 Jul 2011 11:24:44 -0000 1.458 --- gdb/remote.c 26 Jul 2011 20:51:01 -0000 *************** remote_remove_watchpoint (CORE_ADDR addr *** 7763,7771 **** --- 7763,7785 ---- 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) { if (type == bp_hardware_breakpoint) *************** Specify the serial device it is connecte *** 10356,10361 **** --- 10370,10377 ---- 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; *************** Specify a negative limit for unlimited." *** 10751,10756 **** --- 10767,10781 ---- 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."), _("\ Index: gdb/doc/gdb.texinfo =================================================================== RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v retrieving revision 1.850 diff -c -p -r1.850 gdb.texinfo *** gdb/doc/gdb.texinfo 26 Jul 2011 16:59:23 -0000 1.850 --- gdb/doc/gdb.texinfo 26 Jul 2011 20:51:08 -0000 *************** responses. *** 16655,16660 **** --- 16655,16672 ---- 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}