Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <yao@codesourcery.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: <gdb-patches@sourceware.org>
Subject: Re: [PATCH 3/4] Handle parse number error in goto_bookmark_command
Date: Thu, 06 Mar 2014 07:10:00 -0000	[thread overview]
Message-ID: <53181EBE.7050606@codesourcery.com> (raw)
In-Reply-To: <20140305143813.GC16858@adacore.com>

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  <yao@codesourcery.com>
    
    	* 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  <yao@codesourcery.com>
 
+	* 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  <yao@codesourcery.com>
+
 	* 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


  reply	other threads:[~2014-03-06  7:10 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-05 12:49 [PATCH 0/4] Tweak get_number related code Yao Qi
2014-03-05 12:49 ` [PATCH 4/4] Remove argument optional_p from get_tracepoint_by_number Yao Qi
2014-03-05 14:44   ` Joel Brobecker
2014-03-05 12:49 ` [PATCH 3/4] Handle parse number error in goto_bookmark_command Yao Qi
2014-03-05 14:38   ` Joel Brobecker
2014-03-06  7:10     ` Yao Qi [this message]
2014-03-05 12:49 ` [OBV PATCH 1/4] Add a newline in output messages Yao Qi
2014-03-05 14:22   ` Joel Brobecker
2014-03-06  6:45     ` Yao Qi
2014-03-05 12:49 ` [PATCH 2/4] Error on bad count number Yao Qi
2014-03-05 14:29   ` Joel Brobecker
2014-03-05 15:59     ` Pedro Alves
2014-03-06  9:56       ` Yao Qi
2014-03-06 12:21         ` Pedro Alves
2014-03-06 13:24           ` Joel Brobecker
2014-03-07  9:40           ` Yao Qi
2014-03-07 10:53             ` Eli Zaretskii
2014-03-07 11:09               ` Yao Qi
2014-03-07 13:27             ` Pedro Alves
2014-03-07 13:50               ` Joel Brobecker
2014-03-10  2:01               ` Yao Qi
2014-03-06 13:26       ` Joel Brobecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53181EBE.7050606@codesourcery.com \
    --to=yao@codesourcery.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox