Fix test names starting with uppercase using multi-line gdb_test_no_output
[deliverable/binutils-gdb.git] / gdb / reverse.c
index 1437b406eced0ecd3e3496a356b5472066261a15..2c1abdccda9610b4512fcbabbb08c5a61ed6e77c 100644 (file)
@@ -1,7 +1,6 @@
 /* Reverse execution and reverse debugging.
 
-   Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011
-   Free Software Foundation, Inc.
+   Copyright (C) 2006-2016 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #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:
@@ -143,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 ());
@@ -217,10 +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;
-
   if (bookmark_chain == NULL)
     {
       warning (_("No bookmarks."));
@@ -235,10 +230,10 @@ delete_bookmark_command (char *args, int from_tty)
       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);
@@ -252,16 +247,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;
     }
 
@@ -270,12 +266,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;
@@ -287,7 +287,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
@@ -320,20 +320,16 @@ bookmark_1 (int bnum)
 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);
        }
     }
This page took 0.032817 seconds and 4 git commands to generate.