From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11887 invoked by alias); 6 Mar 2014 12:21:32 -0000 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 Received: (qmail 11875 invoked by uid 89); 6 Mar 2014 12:21:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 06 Mar 2014 12:21:30 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s26CLQvP017975 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 6 Mar 2014 07:21:26 -0500 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s26CLNn6020191; Thu, 6 Mar 2014 07:21:24 -0500 Message-ID: <53186842.9030704@redhat.com> Date: Thu, 06 Mar 2014 12:21:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 MIME-Version: 1.0 To: Yao Qi CC: Joel Brobecker , gdb-patches@sourceware.org Subject: Re: [PATCH 2/4] Error on bad count number References: <1394023608-10761-1-git-send-email-yao@codesourcery.com> <1394023608-10761-3-git-send-email-yao@codesourcery.com> <20140305142939.GB16858@adacore.com> <531749BA.8050806@redhat.com> <5318456D.3010709@codesourcery.com> In-Reply-To: <5318456D.3010709@codesourcery.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2014-03/txt/msg00153.txt.bz2 On 03/06/2014 09:52 AM, Yao Qi wrote: > On 03/05/2014 11:58 PM, Pedro Alves wrote: >> I had the same thought. I wondered whether 0 was meant to >> remove the enable count, but the docs don't say anything >> about it. Is there another way to disable the count, and >> bring back the disposition to enabled? If not, I wonder >> whether using 0 for that would be a good idea? > > If 0 is potentially acceptable, I am fine to keep it. I'll back > to change get_number to return negative for invalid input, to > differentiate valid number zero and invalid input. AFAICS, get_number handles negative numbers. E.g., (top-gdb) ignore -6 1 Will ignore next crossing of breakpoint -6. I think that what exact number is used for error return is mostly irrelevant. The interface of get_number's value return alone is just not sufficient as is. Not changing the prototype, we could e.g. in addition of checking for zero return, have the callers check whether the passed in char pointer pointer advanced (and make sure get_number doesn't advance the pointer on invalid input). So the correct use becomes: p = arg; num = get_number (&p); if (num == 0 && p == arg) error (_("Bad number: '%s'"), arg); Sort of like strtol vs itoa. -- Pedro Alves