/* Reverse execution and reverse debugging.
- Copyright (C) 2006-2015 Free Software Foundation, Inc.
+ Copyright (C) 2006-2017 Free Software Foundation, Inc.
This file is part of GDB.
error (_("target_get_bookmark failed."));
/* Set up a bookmark struct. */
- b = xcalloc (1, sizeof (struct bookmark));
+ b = XCNEW (struct bookmark);
b->number = ++bookmark_count;
init_sal (&b->sal);
b->pc = regcache_read_pc (get_current_regcache ());
static void
delete_bookmark_command (char *args, int from_tty)
{
- int num;
- struct get_number_or_range_state state;
-
if (bookmark_chain == NULL)
{
warning (_("No bookmarks."));
return;
}
- init_number_or_range (&state, args);
- while (!state.finished)
+ number_or_range_parser parser (args);
+ while (!parser.finished ())
{
- num = get_number_or_range (&state);
+ int num = parser.get_number ();
if (!delete_one_bookmark (num))
/* Not found. */
warning (_("No bookmark #%d."), num);
if (args == NULL || args[0] == '\0')
error (_("Command requires an argument."));
- if (strncmp (args, "start", strlen ("start")) == 0
- || strncmp (args, "begin", strlen ("begin")) == 0
- || strncmp (args, "end", strlen ("end")) == 0)
+ if (startswith (args, "start")
+ || startswith (args, "begin")
+ || startswith (args, "end"))
{
/* Special case. Give target opportunity to handle. */
target_goto_bookmark ((gdb_byte *) args, from_tty);
static void
bookmarks_info (char *args, int from_tty)
{
- int bnum = -1;
-
if (!bookmark_chain)
printf_filtered (_("No bookmarks.\n"));
else if (args == NULL || *args == '\0')
bookmark_1 (-1);
else
{
- struct get_number_or_range_state state;
-
- init_number_or_range (&state, args);
- while (!state.finished)
+ number_or_range_parser parser (args);
+ while (!parser.finished ())
{
- bnum = get_number_or_range (&state);
+ int bnum = parser.get_number ();
bookmark_1 (bnum);
}
}