From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17978 invoked by alias); 5 Mar 2014 12:49:15 -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 17859 invoked by uid 89); 5 Mar 2014 12:49:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: relay1.mentorg.com Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 05 Mar 2014 12:49:13 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1WLBG2-0004QM-En from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Wed, 05 Mar 2014 04:49:10 -0800 Received: from SVR-ORW-FEM-05.mgc.mentorg.com ([147.34.97.43]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Wed, 5 Mar 2014 04:49:10 -0800 Received: from qiyao.dyndns.org.dyndns.org (147.34.91.1) by svr-orw-fem-05.mgc.mentorg.com (147.34.97.43) with Microsoft SMTP Server id 14.2.247.3; Wed, 5 Mar 2014 04:48:24 -0800 From: Yao Qi To: Subject: [PATCH 2/4] Error on bad count number Date: Wed, 05 Mar 2014 12:49:00 -0000 Message-ID: <1394023608-10761-3-git-send-email-yao@codesourcery.com> In-Reply-To: <1394023608-10761-1-git-send-email-yao@codesourcery.com> References: <1394023608-10761-1-git-send-email-yao@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2014-03/txt/msg00109.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. --- gdb/breakpoint.c | 4 ++++ gdb/testsuite/gdb.base/ena-dis-br.exp | 5 +++++ 2 files changed, 9 insertions(+), 0 deletions(-) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 2f2c625..5dcaa0e 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -14934,8 +14934,12 @@ do_map_enable_count_breakpoint (struct breakpoint *bpt, void *countptr) static void enable_count_command (char *args, int from_tty) { + char *p = args; int count = get_number (&args); + if (count == 0) + error (_("Bad count number '%s'"), p); + 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" + # 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.) -- 1.7.7.6