From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10571 invoked by alias); 6 Mar 2014 07:10: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 10559 invoked by uid 89); 6 Mar 2014 07:10: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, 06 Mar 2014 07:10:10 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1WLSRT-0002T2-8h from Yao_Qi@mentor.com ; Wed, 05 Mar 2014 23:10:07 -0800 Received: from SVR-ORW-FEM-04.mgc.mentorg.com ([147.34.97.41]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Wed, 5 Mar 2014 23:10:07 -0800 Received: from qiyao.dyndns.org (147.34.91.1) by svr-orw-fem-04.mgc.mentorg.com (147.34.97.41) with Microsoft SMTP Server id 14.2.247.3; Wed, 5 Mar 2014 23:10:06 -0800 Message-ID: <53181EBE.7050606@codesourcery.com> Date: Thu, 06 Mar 2014 07:10:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 To: Joel Brobecker CC: Subject: Re: [PATCH 3/4] Handle parse number error in goto_bookmark_command References: <1394023608-10761-1-git-send-email-yao@codesourcery.com> <1394023608-10761-4-git-send-email-yao@codesourcery.com> <20140305143813.GC16858@adacore.com> In-Reply-To: <20140305143813.GC16858@adacore.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2014-03/txt/msg00149.txt.bz2 On 03/05/2014 10:38 PM, Joel Brobecker wrote: >> (gdb) goto-bookmark 1.1 >> > goto-bookmark: no bookmark found for '1.1'. > I would use "invalid bookmark number"... > OK, this message is fine to me. Patch is updated and pushed in. -- Yao (齐尧) Handle parse number error in goto_bookmark_command 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: invalid bookmark number '1.1'. gdb: 2014-03-06 Yao Qi * reverse.c (goto_bookmark_command): Add local 'p'. Emit error early if get_number returns zero. Use 'p' instead of 'args'. diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 8088e64..3a1124a 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2014-03-06 Yao Qi + * reverse.c (goto_bookmark_command): Add local 'p'. Emit error + early if get_number returns zero. Use 'p' instead of 'args'. + +2014-03-06 Yao Qi + * cli/cli-utils.c (get_number_trailer): Add '\n' at the end of message. diff --git a/gdb/reverse.c b/gdb/reverse.c index 582252c..30a0328 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: invalid bookmark number '%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