From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16473 invoked by alias); 4 Mar 2013 14:38:22 -0000 Received: (qmail 16297 invoked by uid 22791); 4 Mar 2013 14:38:19 -0000 X-SWARE-Spam-Status: No, hits=-4.6 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL 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; Mon, 04 Mar 2013 14:37:53 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1UCWWV-0001AR-S5 from Yao_Qi@mentor.com ; Mon, 04 Mar 2013 06:37:51 -0800 Received: from SVR-ORW-FEM-05.mgc.mentorg.com ([147.34.97.43]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Mon, 4 Mar 2013 06:37:51 -0800 Received: from qiyao.dyndns.org (147.34.91.1) by svr-orw-fem-05.mgc.mentorg.com (147.34.97.43) with Microsoft SMTP Server id 14.1.289.1; Mon, 4 Mar 2013 06:37:51 -0800 Message-ID: <5134B192.8080507@codesourcery.com> Date: Mon, 04 Mar 2013 14:38:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Pedro Alves CC: Subject: Re: [PATCH 1/2] use zuinteger_unlimited for some remote commands References: <1360934868-5807-1-git-send-email-yao@codesourcery.com> <1360934868-5807-2-git-send-email-yao@codesourcery.com> <51349F6E.8020101@redhat.com> In-Reply-To: <51349F6E.8020101@redhat.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit 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: 2013-03/txt/msg00086.txt.bz2 On 03/04/2013 09:19 PM, Pedro Alves wrote: > On 02/15/2013 01:27 PM, Yao Qi wrote: >> -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; > > ... > >> @@ -8259,7 +8255,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) > > This made me notice something with var_zuinteger_unlimited. > > What's the point of making it work with unsigned variables, > and UINT_MAX, if the contents of the variable are actually > treated as int everywhere in cli-setshow.c? (and val is > still cut at INT_MAX). Vis, e.g., > Yes, in cli-setshow.c, the val is treated as signed integer, because -1 stands for unlimited. Outside of cli, var_zuinteger_unlimited is about a unsigned integer with a unlimited state. That is reason I change type of "remote_hw_watchpoint_limit" from signed to unsigned. Their default value is unlimited (-1), so I initialize them to UINT_MAX. Originally I used "(unsigned int) -1", but UINT_MAX is better as "unlimited" here. -- Yao (齐尧)