aboutsummaryrefslogtreecommitdiff
path: root/gdb/reverse.c
diff options
context:
space:
mode:
authorYao Qi <yao@codesourcery.com>2014-02-22 14:42:12 +0800
committerYao Qi <yao@codesourcery.com>2014-03-06 15:03:30 +0800
commit0c13193f334ea744a251f768179468b5a17915b6 (patch)
tree290492a472e6dbe7c54c365a3113e29bd207ce80 /gdb/reverse.c
parent2217da06d8dbaf59c17bd363935bd926e5fdc8ab (diff)
downloadfsf-binutils-gdb-0c13193f334ea744a251f768179468b5a17915b6.zip
fsf-binutils-gdb-0c13193f334ea744a251f768179468b5a17915b6.tar.gz
fsf-binutils-gdb-0c13193f334ea744a251f768179468b5a17915b6.tar.bz2
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'.
Diffstat (limited to 'gdb/reverse.c')
-rw-r--r--gdb/reverse.c7
1 files changed, 6 insertions, 1 deletions
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