From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18457 invoked by alias); 5 Mar 2014 12:49:18 -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 18380 invoked by uid 89); 5 Mar 2014 12:49:17 -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:15 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1WLBG3-0004RI-T9 from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Wed, 05 Mar 2014 04:49:11 -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); Wed, 5 Mar 2014 04:49:11 -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:26 -0800 From: Yao Qi To: Subject: [PATCH 3/4] Handle parse number error in goto_bookmark_command Date: Wed, 05 Mar 2014 12:49:00 -0000 Message-ID: <1394023608-10761-4-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/msg00112.txt.bz2 In GDB mainline, the error message for goto-bookmark isn't perfect. (gdb) goto-bookmark 1.1 goto-bookmark: no bookmark found for ''. This patch tweaks the error message by checking the return value of get_number. With patch applied, it becomes: (gdb) goto-bookmark 1.1 goto-bookmark: no bookmark found for '1.1'. gdb: 2014-03-05 Yao Qi * reverse.c (goto_bookmark_command): Add local 'p'. Emit error early if get_number returns zero. Use 'p' instead of 'args'. --- gdb/reverse.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/gdb/reverse.c b/gdb/reverse.c index 582252c..0ceecf9 100644 --- a/gdb/reverse.c +++ b/gdb/reverse.c @@ -250,6 +250,7 @@ goto_bookmark_command (char *args, int from_tty) { struct bookmark *b; unsigned long num; + char *p = args; if (args == NULL || args[0] == '\0') error (_("Command requires an argument.")); @@ -274,6 +275,10 @@ goto_bookmark_command (char *args, int from_tty) /* General case. Bookmark identified by bookmark number. */ num = get_number (&args); + + if (num == 0) + error (_("goto-bookmark: no bookmark found for '%s'."), p); + ALL_BOOKMARKS (b) if (b->number == num) break; @@ -285,7 +290,7 @@ goto_bookmark_command (char *args, int from_tty) return; } /* Not found. */ - error (_("goto-bookmark: no bookmark found for '%s'."), args); + error (_("goto-bookmark: no bookmark found for '%s'."), p); } static int -- 1.7.7.6