From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24979 invoked by alias); 1 Aug 2012 13:56:54 -0000 Received: (qmail 24858 invoked by uid 22791); 1 Aug 2012 13:56:51 -0000 X-SWARE-Spam-Status: No, hits=-4.3 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,TW_BP X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 01 Aug 2012 13:56:37 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1SwZPh-0003OC-7S from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Wed, 01 Aug 2012 06:56:37 -0700 Received: from SVR-ORW-FEM-02.mgc.mentorg.com ([147.34.96.206]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Wed, 1 Aug 2012 06:56:37 -0700 Received: from qiyao.dyndns.org.dyndns.org (147.34.91.1) by svr-orw-fem-02.mgc.mentorg.com (147.34.96.168) with Microsoft SMTP Server id 14.1.289.1; Wed, 1 Aug 2012 06:56:35 -0700 From: Yao Qi To: Subject: [PATCH 2/3] use zuinteger_unlimited for some remote commands Date: Wed, 01 Aug 2012 13:56:00 -0000 Message-ID: <1343829334-3151-3-git-send-email-yao@codesourcery.com> In-Reply-To: <1343829334-3151-1-git-send-email-yao@codesourcery.com> References: <7A6A55B4-0293-4AD6-AB1F-B3169F8ADCC1@cs.umd.edu> <1343829334-3151-1-git-send-email-yao@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain 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: 2012-08/txt/msg00022.txt.bz2 Hi, These 'set remot XXX-limit' commands have the similar requirements to 'set listsize', so I convert them from zinteger_cmd to zuinteger_unlimited_cmd. New tests are added to check these commands work correctly. gdb: 2012-08-01 Yao Qi * remote.c: Add 'static' and 'unsigned' to remote_hw_watchpoint_limit, remote_hw_watchpoint_length_limit and remote_hw_breakpoint_limit. (remote_region_ok_for_hw_watchpoint): Don't check the case 'limit' is less than 0. (remote_check_watch_resources): Likewise. (_initialize_remote): Call add_setshow_zuinteger_unlimited_cmd instead of add_setshow_zinteger_cmd. gdb/testsuite: 2012-08-01 Yao Qi * gdb.base/setshow.exp: Test for setting ahd showing hardware-watchpoint-limit, hardware-watchpoint-length-limit and hardware-breakpoint-limit. --- gdb/remote.c | 53 ++++++++++++++++++----------------- gdb/testsuite/gdb.base/setshow.exp | 20 +++++++++++++ 2 files changed, 47 insertions(+), 26 deletions(-) diff --git a/gdb/remote.c b/gdb/remote.c index 6780212..53a1e72 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -8109,17 +8109,15 @@ 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 unsigned int remote_hw_watchpoint_limit = UINT_MAX; +static unsigned int remote_hw_watchpoint_length_limit = UINT_MAX; +static unsigned int remote_hw_breakpoint_limit = UINT_MAX; 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 @@ -8133,8 +8131,6 @@ remote_check_watch_resources (int type, int cnt, int ot) { if (remote_hw_breakpoint_limit == 0) return 0; - else if (remote_hw_breakpoint_limit < 0) - return 1; else if (cnt <= remote_hw_breakpoint_limit) return 1; } @@ -8142,7 +8138,7 @@ remote_check_watch_resources (int type, int cnt, int ot) { if (remote_hw_watchpoint_limit == 0) return 0; - else if (remote_hw_watchpoint_limit < 0) + else if (remote_hw_watchpoint_limit == UINT_MAX) return 1; else if (ot) return -1; @@ -11432,33 +11428,38 @@ 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, - &remote_hw_watchpoint_limit, _("\ + 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, - &remote_hw_watchpoint_length_limit, _("\ + NULL, NULL, /* FIXME: i18n: The maximum + number of target hardware + watchpoints is %s. */ + &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. */ - &remote_set_cmdlist, &remote_show_cmdlist); - add_setshow_zinteger_cmd ("hardware-breakpoint-limit", no_class, - &remote_hw_breakpoint_limit, _("\ + NULL, NULL, /* FIXME: i18n: The maximum + length (in bytes) of a + target hardware watchpoint + is %s. */ + &remote_set_cmdlist, + &remote_show_cmdlist); + 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. */ - &remote_set_cmdlist, &remote_show_cmdlist); + NULL, NULL, /* FIXME: i18n: The maximum + number of target hardware + breakpoints is %s. */ + &remote_set_cmdlist, + &remote_show_cmdlist); add_setshow_integer_cmd ("remoteaddresssize", class_obscure, &remote_address_size, _("\ diff --git a/gdb/testsuite/gdb.base/setshow.exp b/gdb/testsuite/gdb.base/setshow.exp index 9af5c30..7821024 100644 --- a/gdb/testsuite/gdb.base/setshow.exp +++ b/gdb/testsuite/gdb.base/setshow.exp @@ -256,3 +256,23 @@ gdb_test "show verbose" "Verbose printing of informational messages is on..*" "s gdb_test_no_output "set verbose off" "set verbose off" #test show verbose off gdb_test "show verbose" "Verbosity is off..*" "show verbose (off)" + +foreach remote_bpkt_option { + "hardware-watchpoint-limit" + "hardware-watchpoint-length-limit" + "hardware-breakpoint-limit" +} { + gdb_test "show remote ${remote_bpkt_option}" \ + "The maximum .* is unlimited.*" \ + "show remote ${remote_bpkt_option} unlimited 1" + gdb_test_no_output "set remote ${remote_bpkt_option} 1" + + gdb_test "set remote ${remote_bpkt_option} -2" \ + "only -1 is allowed to set as unlimited.*" + + gdb_test_no_output "set remote ${remote_bpkt_option} -1" + gdb_test "show remote ${remote_bpkt_option}" \ + "The maximum .* is unlimited.*" \ + "show remote ${remote_bpkt_option} unlimited 2" +} + -- 1.7.7.6