X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Freverse.c;h=a1b697f4d21ea9dca68d55d3cb83e1a2e1e25ff2;hb=f42bf748e417cf9120fc57d144b6eaaf3adda247;hp=042296ee25a1c989a97104bde1963240de07f2d0;hpb=0b30217134add051e159a192066a1e568ebd837f;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/reverse.c b/gdb/reverse.c index 042296ee25..a1b697f4d2 100644 --- a/gdb/reverse.c +++ b/gdb/reverse.c @@ -1,6 +1,6 @@ /* Reverse execution and reverse debugging. - Copyright (C) 2006-2012 Free Software Foundation, Inc. + Copyright (C) 2006-2016 Free Software Foundation, Inc. This file is part of GDB. @@ -18,13 +18,13 @@ along with this program. If not, see . */ #include "defs.h" -#include "gdb_string.h" #include "target.h" #include "top.h" #include "cli/cli-cmds.h" #include "cli/cli-decode.h" #include "cli/cli-utils.h" #include "inferior.h" +#include "infrun.h" #include "regcache.h" /* User interface: @@ -142,7 +142,7 @@ save_bookmark_command (char *args, int from_tty) 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 ()); @@ -216,7 +216,6 @@ delete_all_bookmarks (void) static void delete_bookmark_command (char *args, int from_tty) { - struct bookmark *b; int num; struct get_number_or_range_state state; @@ -251,16 +250,17 @@ 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.")); - 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 (args, from_tty); + target_goto_bookmark ((gdb_byte *) args, from_tty); return; } @@ -269,12 +269,16 @@ goto_bookmark_command (char *args, int from_tty) /* Special case -- quoted string. Pass on to target. */ if (args[strlen (args) - 1] != args[0]) error (_("Unbalanced quotes: %s"), args); - target_goto_bookmark (args, from_tty); + target_goto_bookmark ((gdb_byte *) args, from_tty); return; } /* 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; @@ -286,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