From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5778 invoked by alias); 13 Mar 2014 02:35:12 -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 5668 invoked by uid 89); 13 Mar 2014 02:35:11 -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; Thu, 13 Mar 2014 02:35:10 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1WNvUC-0001PD-5x from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Wed, 12 Mar 2014 19:35:08 -0700 Received: from SVR-ORW-FEM-03.mgc.mentorg.com ([147.34.97.39]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Wed, 12 Mar 2014 19:35:08 -0700 Received: from qiyao.dyndns.org.com (147.34.91.1) by svr-orw-fem-03.mgc.mentorg.com (147.34.97.39) with Microsoft SMTP Server id 14.2.247.3; Wed, 12 Mar 2014 19:35:07 -0700 From: Yao Qi To: Subject: [PATCH 3/5] Emit wrong value error when parsing range Date: Thu, 13 Mar 2014 02:35:00 -0000 Message-ID: <1394677950-4054-4-git-send-email-yao@codesourcery.com> In-Reply-To: <1394677950-4054-1-git-send-email-yao@codesourcery.com> References: <1394677950-4054-1-git-send-email-yao@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2014-03/txt/msg00307.txt.bz2 The current code in get_number_or_range doesn't check the return value of get_number, so current gdb does: (gdb) thread apply 1-1.2 bt inverted range which is a little bit confusing. This patch adds a check to get_number's return value, and emit error "wrong value" if return value is zero. With this patch applied, gdb prints: (gdb) thread apply 1-1.2 bt wrong value gdb: 2014-03-13 Yao Qi * cli/cli-utils.c (get_number_or_range): Error out if get_number returns zero. --- gdb/cli/cli-utils.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/gdb/cli/cli-utils.c b/gdb/cli/cli-utils.c index a0ebc11..d59a231 100644 --- a/gdb/cli/cli-utils.c +++ b/gdb/cli/cli-utils.c @@ -146,7 +146,9 @@ get_number_or_range (struct get_number_or_range_state *state) temp = &state->end_ptr; state->end_ptr = skip_spaces (state->string + 1); state->end_value = get_number (temp); - if (state->end_value < state->last_retval) + if (state->end_value == 0) + error (_("wrong value")); + else if (state->end_value < state->last_retval) { error (_("inverted range")); } -- 1.7.7.6