2012-05-07 Sergio Durigan Junior <sergiodj@redhat.com>
[binutils-gdb.git] / gdb / reverse.c
index d501ceb6e317b069bfb9b80b4e51c56a08a11264..042296ee25a1c989a97104bde1963240de07f2d0 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-2012 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -24,6 +23,7 @@
 #include "top.h"
 #include "cli/cli-cmds.h"
 #include "cli/cli-decode.h"
+#include "cli/cli-utils.h"
 #include "inferior.h"
 #include "regcache.h"
 
@@ -49,9 +49,6 @@ exec_reverse_once (char *cmd, char *args, int from_tty)
   enum exec_direction_kind dir = execution_direction;
   struct cleanup *old_chain;
 
-  if (dir == EXEC_ERROR)
-    error (_("Target %s does not support this command."), target_shortname);
-
   if (dir == EXEC_REVERSE)
     error (_("Already in reverse mode.  Use '%s' or 'set exec-dir forward'."),
           cmd);
@@ -186,7 +183,7 @@ delete_one_bookmark (int num)
   if (b == bookmark_chain)
     bookmark_chain = b->next;
 
-  /* Find bookmark preceeding "marked" one, so we can unlink.  */
+  /* Find bookmark preceding "marked" one, so we can unlink.  */
   if (b)
     {
       ALL_BOOKMARKS (b1)
@@ -221,6 +218,7 @@ delete_bookmark_command (char *args, int from_tty)
 {
   struct bookmark *b;
   int num;
+  struct get_number_or_range_state state;
 
   if (bookmark_chain == NULL)
     {
@@ -236,9 +234,10 @@ delete_bookmark_command (char *args, int from_tty)
       return;
     }
 
-  while (args != NULL && *args != '\0')
+  init_number_or_range (&state, args);
+  while (!state.finished)
     {
-      num = get_number_or_range (&args);
+      num = get_number_or_range (&state);
       if (!delete_one_bookmark (num))
        /* Not found.  */
        warning (_("No bookmark #%d."), num);
@@ -327,11 +326,16 @@ bookmarks_info (char *args, int from_tty)
   else if (args == NULL || *args == '\0')
     bookmark_1 (-1);
   else
-    while (args != NULL && *args != '\0')
-      {
-       bnum = get_number_or_range (&args);
-       bookmark_1 (bnum);
-      }
+    {
+      struct get_number_or_range_state state;
+
+      init_number_or_range (&state, args);
+      while (!state.finished)
+       {
+         bnum = get_number_or_range (&state);
+         bookmark_1 (bnum);
+       }
+    }
 }