From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20021 invoked by alias); 5 Mar 2014 14:29:41 -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 20010 invoked by uid 89); 5 Mar 2014 14:29:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 05 Mar 2014 14:29:39 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 86EF011637B; Wed, 5 Mar 2014 09:29:37 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 1RiLz5TK8oJe; Wed, 5 Mar 2014 09:29:37 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 54B4F116356; Wed, 5 Mar 2014 09:29:37 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id C860CE08BE; Wed, 5 Mar 2014 06:29:39 -0800 (PST) Date: Wed, 05 Mar 2014 14:29:00 -0000 From: Joel Brobecker To: Yao Qi Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 2/4] Error on bad count number Message-ID: <20140305142939.GB16858@adacore.com> References: <1394023608-10761-1-git-send-email-yao@codesourcery.com> <1394023608-10761-3-git-send-email-yao@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1394023608-10761-3-git-send-email-yao@codesourcery.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2014-03/txt/msg00119.txt.bz2 > GDB is quiet for these invalid input like this > > (gdb) enable count 1.1 1 > (gdb) > > This patch is to check the input number is valid, and emit error if > input number isn't valid. With this patch, it becomes: > > (gdb) enable count 1.1 1 > Bad count number '1.1 1' > > gdb: > > 2014-03-05 Yao Qi > > * breakpoint.c (enable_count_command): Emit error if 'count' > is zero. > > gdb/testsuite: > > 2014-03-05 Yao Qi > > * gdb.base/ena-dis-br.exp: Test bad count number. I had a slight hesitation here, as we are now going to actively reject "enable count 0 1" where it used to be accepted. But since it makes little sense, and does not work, I think that's OK. Example of it not working: (gdb) b a Breakpoint 1 at 0x401558: file a.adb, line 3. (gdb) enable count 0 1 (gdb) run Starting program: /[...]/a Breakpoint 1, a () at a.adb:3 3 raise Constraint_Error; The good news is that the breakpoint gets disabled afterwards, so it's not completely broken: (gdb) info break Num Type Disp Enb Address What 1 breakpoint dis n 0x0000000000401558 in a at a.adb:3 breakpoint already hit 1 time > + if (count == 0) > + error (_("Bad count number '%s'"), p); I would change it to "Invalid count number" instead. > + > map_breakpoint_numbers (args, do_map_enable_count_breakpoint, &count); > } > > diff --git a/gdb/testsuite/gdb.base/ena-dis-br.exp b/gdb/testsuite/gdb.base/ena-dis-br.exp > index 6f2c469..4b83e56 100644 > --- a/gdb/testsuite/gdb.base/ena-dis-br.exp > +++ b/gdb/testsuite/gdb.base/ena-dis-br.exp > @@ -169,6 +169,11 @@ gdb_test "continue" \ > ".*marker1 .*:($bp_location15|$bp_location16).*" \ > "continue through enable count, now disabled" > > +# Test enable count with bad count number. > + > +gdb_test "enable count 1.1 $bp" "Bad count number '1.1 $bp'.*" \ > + "enable count with bad number" Can you also add a test for '0' as the count number? > # Verify that we can set a breakpoint with an ignore count N, which > # should cause the next N triggers of the bp to be ignored. (This is > # a flavor of enablement/disablement, after all.) Thank you, -- Joel