This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 3/4] Handle parse number error in goto_bookmark_command


>  (gdb) goto-bookmark 1.1
>  goto-bookmark: no bookmark found for '1.1'.

I would use "invalid bookmark number"...

> 2014-03-05  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'.

Otherwise, LGTM.


> ---
>  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

-- 
Joel


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]