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'.
+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
{
struct bookmark *b;
unsigned long num;
+ char *p = args;
if (args == NULL || args[0] == '\0')
error (_("Command requires an argument."));
/* 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;
return;
}
/* Not found. */
- error (_("goto-bookmark: no bookmark found for '%s'."), args);
+ error (_("goto-bookmark: no bookmark found for '%s'."), p);
}
static int