]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
2008-10-07 Michael Snyder <msnyder@vmware.com>
authorMichael Snyder <msnyder@vmware.com>
Wed, 8 Oct 2008 00:26:28 +0000 (00:26 +0000)
committerMichael Snyder <msnyder@vmware.com>
Wed, 8 Oct 2008 00:26:28 +0000 (00:26 +0000)
* target.h (to_set_exec_direction, to_get_exec_direction): Remove.
(to_can_execute_reverse): New method.
(enum exec_direction_kind): Move to inferior.h.
* target.c (update_current_target): Inherit to_can_execute_reverse.
Remove to_set_exec_direction, to_get_exec_direction.
* inferior.h (enum exec_direction_kind): Move from target.h.

* infrun.c (set_exec_direction_func): Move here from reverse.c.
(show_exec_direction_func): Ditto.
(proceed): Consult global execution_direction instead of
target method.
(handle_inferior_event): Ditto.

* reverse.c (set_exec_direction_func): Move to infrun.c
(show_exec_direction_func): Ditto.
(exec_direction_default): Set infrun global variable.
(exec_reverse_once): Consult infrun global direction variable.

* infcmd.c (step_1): Consult infrun global direction variable.
(step_once): Ditto.
(until_next_command): Ditto.
(finish_command): Ditto.

* record.h (record_exec_direction): Delete.
(RECORD_IS_REPLAY): Consult infrun global direction variable.

* record.c: (record_wait_cleanups): Use infrun state variable.
(record_wait): Ditto.
(record_get_exec_direction, record_set_exec_direction): Remove.
(record_can_execute_reverse): New target method.

* remote.c (remote_resume): Use infrun state variable.
(remote_get_exec_direction, remote_set_exec_direction): Remove.
(remote_can_execute_reverse): New target method.

gdb/ChangeLog
gdb/infcmd.c
gdb/inferior.h
gdb/infrun.c
gdb/record.c
gdb/record.h
gdb/remote.c
gdb/reverse.c
gdb/target.c
gdb/target.h

index f02450f8fb2e7c5e094c578a9207e989586650cb..9c3355c24fd9f6150f25e5cff0bca84049d53184 100644 (file)
@@ -1,3 +1,40 @@
+2008-10-07  Michael Snyder  <msnyder@vmware.com>
+
+       * target.h (to_set_exec_direction, to_get_exec_direction): Remove.
+       (to_can_execute_reverse): New method.
+       (enum exec_direction_kind): Move to inferior.h.
+       * target.c (update_current_target): Inherit to_can_execute_reverse.
+       Remove to_set_exec_direction, to_get_exec_direction.
+       * inferior.h (enum exec_direction_kind): Move from target.h.
+
+       * infrun.c (set_exec_direction_func): Move here from reverse.c.
+       (show_exec_direction_func): Ditto.
+       (proceed): Consult global execution_direction instead of 
+       target method.
+       (handle_inferior_event): Ditto.
+
+       * reverse.c (set_exec_direction_func): Move to infrun.c
+       (show_exec_direction_func): Ditto.
+       (exec_direction_default): Set infrun global variable.
+       (exec_reverse_once): Consult infrun global direction variable.
+
+       * infcmd.c (step_1): Consult infrun global direction variable.
+       (step_once): Ditto.
+       (until_next_command): Ditto.
+       (finish_command): Ditto.
+
+       * record.h (record_exec_direction): Delete.
+       (RECORD_IS_REPLAY): Consult infrun global direction variable.
+
+       * record.c: (record_wait_cleanups): Use infrun state variable.
+       (record_wait): Ditto.
+       (record_get_exec_direction, record_set_exec_direction): Remove.
+       (record_can_execute_reverse): New target method.
+
+       * remote.c (remote_resume): Use infrun state variable.
+       (remote_get_exec_direction, remote_set_exec_direction): Remove.
+       (remote_can_execute_reverse): New target method.
+
 2008-10-07  Michael Snyder  <msnyder@vmware.com>
 
        * infrun.c (stepped_into_function): Rename handle_step_into_function.
index f1329fbb2b1715b96c7e84bae39d8014c39fac68..131f4af82635ed4f0d889ea9923ba07616fb3d2b 100644 (file)
@@ -1454,7 +1454,7 @@ finish_command (char *arg, int from_tty)
     error (_("Asynchronous execution not supported on this target."));
 
   /* Don't try to async in reverse.  */
-  if (async_exec && target_get_execution_direction () == EXEC_REVERSE)
+  if (async_exec && execution_direction == EXEC_REVERSE)
     error (_("Asynchronous 'finish' not supported in reverse."));
 
   /* If we are not asked to run in the bg, then prepare to run in the
@@ -1486,7 +1486,7 @@ finish_command (char *arg, int from_tty)
      source.  */
   if (from_tty)
     {
-      if (target_get_execution_direction () == EXEC_REVERSE)
+      if (execution_direction == EXEC_REVERSE)
        printf_filtered (_("Run back to call of "));
       else
        printf_filtered (_("Run till exit from "));
@@ -1494,7 +1494,7 @@ finish_command (char *arg, int from_tty)
       print_stack_frame (get_selected_frame (NULL), 1, LOCATION);
     }
 
-  if (target_get_execution_direction () == EXEC_REVERSE)
+  if (execution_direction == EXEC_REVERSE)
     {
       /* Split off at this point.  */
       finish_backward (function, tp);
index 43f902238ff72133730aa606dbfd8b1908b541d7..8b03b63d18beac535b891483141eaacd8c7bf296 100644 (file)
@@ -339,6 +339,16 @@ enum stop_kind
     STOP_QUIETLY_NO_SIGSTOP
   };
 
+/* Reverse execution.  */
+enum exec_direction_kind
+  {
+    EXEC_FORWARD,
+    EXEC_REVERSE,
+    EXEC_ERROR
+  };
+
+extern enum exec_direction_kind execution_direction;
+
 /* Nonzero if proceed is being used for a "finish" command or a similar
    situation when stop_registers should be saved.  */
 
index db3eb4d98d5b872b92fdfac6ead48756b69c165d..1449b076ff294d7b4fdc79238e0d12defe34f0f3 100644 (file)
@@ -1203,7 +1203,7 @@ proceed (CORE_ADDR addr, enum target_signal siggnal, int step)
   if (addr == (CORE_ADDR) -1)
     {
       if (pc == stop_pc && breakpoint_here_p (pc) 
-         && target_get_execution_direction () != EXEC_REVERSE)
+         && execution_direction != EXEC_REVERSE)
        /* There is a breakpoint at the address we will resume at,
           step one instruction before inserting breakpoints so that
           we do not stop right away (and report a second hit at this
@@ -2886,7 +2886,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (!gdbarch_get_longjmp_target)\n");
            return;
          }
        if (stop_pc == ecs->stop_func_start
-           && target_get_execution_direction () == EXEC_REVERSE)
+           && execution_direction == EXEC_REVERSE)
          {
            /* We are stepping over a function call in reverse, and
               just hit the step-resume breakpoint at the start
@@ -3070,7 +3070,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (!gdbarch_get_longjmp_target)\n");
         keep going back to the call point).  */
       if (stop_pc == ecs->event_thread->step_range_start
          && stop_pc != ecs->stop_func_start
-         && target_get_execution_direction () == EXEC_REVERSE)
+         && execution_direction == EXEC_REVERSE)
        {
          ecs->event_thread->stop_step = 1;
          print_stop_reason (END_STEPPING_RANGE, 0);
@@ -3140,7 +3140,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (!gdbarch_get_longjmp_target)\n");
                    ecs->event_thread->step_frame_id)
       && (frame_id_eq (frame_unwind_id (get_current_frame ()),
                       ecs->event_thread->step_frame_id)
-         || target_get_execution_direction () == EXEC_REVERSE))
+         || execution_direction == EXEC_REVERSE))
     {
       CORE_ADDR real_stop_pc;
 
@@ -3178,7 +3178,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (!gdbarch_get_longjmp_target)\n");
             get there, we'll need to single-step back to the
             caller.  */
 
-         if (target_get_execution_direction () == EXEC_REVERSE)
+         if (execution_direction == EXEC_REVERSE)
            {
              struct symtab_and_line sr_sal;
              init_sal (&sr_sal);
@@ -3227,7 +3227,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (!gdbarch_get_longjmp_target)\n");
        tmp_sal = find_pc_line (ecs->stop_func_start, 0);
        if (tmp_sal.line != 0)
          {
-           if (target_get_execution_direction () == EXEC_REVERSE)
+           if (execution_direction == EXEC_REVERSE)
              handle_step_into_function_backward (ecs);
            else
              handle_step_into_function (ecs);
@@ -3247,7 +3247,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (!gdbarch_get_longjmp_target)\n");
          return;
        }
 
-      if (target_get_execution_direction () == EXEC_REVERSE)
+      if (execution_direction == EXEC_REVERSE)
        {
          /* Set a breakpoint at callee's start address.
             From there we can step once and be back in the caller.  */
@@ -4772,6 +4772,55 @@ save_inferior_ptid (void)
 }
 \f
 
+/* User interface for reverse debugging:
+   Set exec-direction / show exec-direction commands
+   (returns error unless target implements to_set_exec_direction method).  */
+
+enum exec_direction_kind execution_direction = EXEC_FORWARD;
+static const char exec_forward[] = "forward";
+static const char exec_reverse[] = "reverse";
+static const char *exec_direction = exec_forward;
+static const char *exec_direction_names[] = {
+  exec_forward,
+  exec_reverse,
+  NULL
+};
+
+static void
+set_exec_direction_func (char *args, int from_tty,
+                        struct cmd_list_element *cmd)
+{
+  if (target_can_execute_reverse)
+    {
+      if (!strcmp (exec_direction, exec_forward))
+       execution_direction = EXEC_FORWARD;
+      else if (!strcmp (exec_direction, exec_reverse))
+       execution_direction = EXEC_REVERSE;
+    }
+}
+
+static void
+show_exec_direction_func (struct ui_file *out, int from_tty,
+                         struct cmd_list_element *cmd, const char *value)
+{
+  switch (execution_direction) {
+  case EXEC_FORWARD:
+    fprintf_filtered (out, _("Forward.\n"));
+    break;
+  case EXEC_REVERSE:
+    fprintf_filtered (out, _("Reverse.\n"));
+    break;
+  case EXEC_ERROR:
+  default:
+    fprintf_filtered (out, 
+                     _("Forward (target `%s' does not support exec-direction).\n"),
+                     target_shortname);
+    break;
+  }
+}
+
+/* User interface for non-stop mode.  */
+
 int non_stop = 0;
 static int non_stop_1 = 0;
 
@@ -4997,6 +5046,14 @@ breakpoints, even if such is supported by the target."),
                           &maintenance_set_cmdlist,
                           &maintenance_show_cmdlist);
 
+  add_setshow_enum_cmd ("exec-direction", class_run, exec_direction_names,
+                       &exec_direction, _("Set direction of execution.\n\
+Options are 'forward' or 'reverse'."),
+                       _("Show direction of execution (forward/reverse)."),
+                       _("Tells gdb whether to execute forward or backward."),
+                       set_exec_direction_func, show_exec_direction_func,
+                       &setlist, &showlist);
+
   /* ptid initializations */
   null_ptid = ptid_build (0, 0, 0);
   minus_one_ptid = ptid_build (-1, 0, 0);
index 1df9dbda80f90e0ab382377f09ec4947fd1490cd..626edaceb0bfa78553c12f6f92384ddf6767d9ab 100644 (file)
@@ -44,7 +44,6 @@ static int record_insn_num = 0;
 
 struct target_ops record_ops;
 int record_resume_step = 0;
-enum exec_direction_kind record_exec_direction = EXEC_FORWARD;
 static int record_get_sig = 0;
 static sigset_t record_maskall;
 static int record_not_record = 0;
@@ -415,7 +414,6 @@ record_open (char *name, int from_tty)
 
   /* Reset */
   record_insn_num = 0;
-  record_exec_direction = EXEC_FORWARD;
   record_list = &record_first;
   record_list->next = NULL;
 
@@ -458,7 +456,7 @@ record_sig_handler (int signo)
 static void
 record_wait_cleanups (void *ignore)
 {
-  if (record_exec_direction == EXEC_REVERSE)
+  if (execution_direction == EXEC_REVERSE)
     {
       if (record_list->next)
        {
@@ -516,7 +514,7 @@ record_wait (ptid_t ptid, struct target_waitstatus *status)
 
       /* In EXEC_FORWARD mode, record_list point to the tail of prev
          instruction.  */
-      if (record_exec_direction == EXEC_FORWARD && record_list->next)
+      if (execution_direction == EXEC_FORWARD && record_list->next)
         {
          record_list = record_list->next;
        }
@@ -527,14 +525,14 @@ record_wait (ptid_t ptid, struct target_waitstatus *status)
       do
        {
          /* Check for beginning and end of log.  */
-         if (record_exec_direction == EXEC_REVERSE 
+         if (execution_direction == EXEC_REVERSE 
              && record_list == &record_first)
            {
              /* Hit beginning of record log in reverse.  */
              status->kind = TARGET_WAITKIND_NO_HISTORY;
              break;
            }
-         if (record_exec_direction != EXEC_REVERSE && !record_list->next)
+         if (execution_direction != EXEC_REVERSE && !record_list->next)
            {
              /* Hit end of record log going forward.  */
              status->kind = TARGET_WAITKIND_NO_HISTORY;
@@ -602,7 +600,7 @@ record_wait (ptid_t ptid, struct target_waitstatus *status)
                                      record_list->u.need_dasm);
                }
 
-             if (record_exec_direction == EXEC_FORWARD)
+             if (execution_direction == EXEC_FORWARD)
                {
                  need_dasm = record_list->u.need_dasm;
                }
@@ -611,7 +609,7 @@ record_wait (ptid_t ptid, struct target_waitstatus *status)
                  gdbarch_process_record_dasm (current_gdbarch);
                }
 
-             if (first_record_end && record_exec_direction == EXEC_REVERSE)
+             if (first_record_end && execution_direction == EXEC_REVERSE)
                {
                  /* When reverse excute, the first record_end is the part of
                     current instruction. */
@@ -665,7 +663,7 @@ record_wait (ptid_t ptid, struct target_waitstatus *status)
                        }
                    }
                }
-             if (record_exec_direction == EXEC_REVERSE)
+             if (execution_direction == EXEC_REVERSE)
                {
                  need_dasm = record_list->u.need_dasm;
                }
@@ -674,7 +672,7 @@ record_wait (ptid_t ptid, struct target_waitstatus *status)
 next:
          if (continue_flag)
            {
-             if (record_exec_direction == EXEC_REVERSE)
+             if (execution_direction == EXEC_REVERSE)
                {
                  if (record_list->prev)
                    record_list = record_list->prev;
@@ -950,31 +948,10 @@ record_remove_breakpoint (struct bp_target_info *bp_tgt)
   return 0;
 }
 
-static enum exec_direction_kind
-record_get_exec_direction (void)
-{
-  if (record_debug > 1)
-    printf_filtered ("Process record: exec direction is %s\n",
-                    record_exec_direction == EXEC_FORWARD ? "forward" :
-                    record_exec_direction == EXEC_REVERSE ? "reverse" : 
-                    "unknown");
-  return record_exec_direction;
-}
-
 static int
-record_set_exec_direction (enum exec_direction_kind dir)
+record_can_execute_reverse (void)
 {
-  if (record_debug)
-    printf_filtered ("Process record: set exec direction: %s\n",
-                    dir == EXEC_FORWARD ? "forward" :
-                    dir == EXEC_REVERSE ? "reverse" : 
-                    "bad direction");
-
-  /* FIXME: check target for capability.  */
-  if (dir == EXEC_FORWARD || dir == EXEC_REVERSE)
-    return (record_exec_direction = dir);
-  else
-    return EXEC_ERROR;
+  return 1;
 }
 
 static void
@@ -997,8 +974,7 @@ init_record_ops (void)
   record_ops.to_xfer_partial = record_xfer_partial;
   record_ops.to_insert_breakpoint = record_insert_breakpoint;
   record_ops.to_remove_breakpoint = record_remove_breakpoint;
-  record_ops.to_get_exec_direction = record_get_exec_direction;
-  record_ops.to_set_exec_direction = record_set_exec_direction;
+  record_ops.to_can_execute_reverse = record_can_execute_reverse;
   record_ops.to_stratum = record_stratum;
   record_ops.to_magic = OPS_MAGIC;
 }
index 1931b4fcfd75f91c3c3d9000db7a1fa8a7885595..39241e6140e33da8de04f4f8094ac5743350dbc7 100644 (file)
@@ -23,8 +23,9 @@
 #define RECORD_IS_USED   \
      (current_target.beneath == &record_ops)
 #define RECORD_IS_REPLAY \
-     (record_list->next || record_exec_direction == EXEC_REVERSE)
-#define RECORD_TARGET_SUPPORT_RECORD_WAIT      (record_ops.beneath->to_support_record_wait)
+     (record_list->next || execution_direction == EXEC_REVERSE)
+#define RECORD_TARGET_SUPPORT_RECORD_WAIT \
+     (record_ops.beneath->to_support_record_wait)
 
 typedef struct record_reg_s
 {
@@ -77,7 +78,6 @@ extern struct regcache *record_regcache;
 
 extern struct target_ops record_ops;
 extern int record_resume_step;
-extern enum exec_direction_kind record_exec_direction;
 
 extern int record_arch_list_add_reg (int num);
 extern int record_arch_list_add_mem (CORE_ADDR addr, int len);
index 571179e079b0567f4eaa20b38c1f5162c46cf9c1..6d9ef0bd3de4ba10bf5f7574c495c2bf1ef306c4 100644 (file)
@@ -3385,7 +3385,7 @@ remote_resume (ptid_t ptid, int step, enum target_signal siggnal)
     set_continue_thread (ptid);
 
   buf = rs->buf;
-  if (target_get_execution_direction () == EXEC_REVERSE)
+  if (execution_direction == EXEC_REVERSE)
     {
       /* We don't pass signals to the target in reverse exec mode.  */
       if (info_verbose && siggnal != TARGET_SIGNAL_0)
@@ -7560,33 +7560,12 @@ remote_command (char *args, int from_tty)
   help_list (remote_cmdlist, "remote ", -1, gdb_stdout);
 }
 
-/* Reverse execution.
-   TODO: set up as a capability.  */
-static enum exec_direction_kind remote_exec_direction = EXEC_FORWARD;
+static int remote_target_can_reverse = 1;
 
-static enum exec_direction_kind remote_get_exec_direction (void)
-{
-  if (remote_debug && info_verbose)
-    printf_filtered ("remote exec direction is %s\n",
-                    remote_exec_direction == EXEC_FORWARD ? _("forward") :
-                    remote_exec_direction == EXEC_REVERSE ? _("reverse") :
-                    "unknown");
-  return remote_exec_direction;
-}
-
-static int remote_set_exec_direction (enum exec_direction_kind dir)
+static int
+remote_can_execute_reverse (void)
 {
-  if (remote_debug && info_verbose)
-    printf_filtered ("Set remote exec direction: %s\n",
-                    dir == EXEC_FORWARD ? _("forward") :
-                    dir == EXEC_REVERSE ? _("reverse") :
-                    "bad direction");
-
-  /* TODO: check target for capability.  */
-  if (dir == EXEC_FORWARD || dir == EXEC_REVERSE)
-    return (remote_exec_direction = dir);
-  else
-    return EXEC_ERROR;
+  return remote_target_can_reverse;
 }
 
 static void
@@ -7637,8 +7616,7 @@ Specify the serial device it is connected to\n\
   remote_ops.to_has_registers = 1;
   remote_ops.to_has_execution = 1;
   remote_ops.to_has_thread_control = tc_schedlock;     /* can lock scheduler */
-  remote_ops.to_get_exec_direction = remote_get_exec_direction;
-  remote_ops.to_set_exec_direction = remote_set_exec_direction;
+  remote_ops.to_can_execute_reverse = remote_can_execute_reverse;
   remote_ops.to_magic = OPS_MAGIC;
   remote_ops.to_memory_map = remote_memory_map;
   remote_ops.to_flash_erase = remote_flash_erase;
index 320913ff61eabaf6863bc759b9b798cdcc0557c9..ee6567586e0980999634bed837993016d50d56d3 100644 (file)
 #include "top.h"
 #include "cli/cli-cmds.h"
 #include "cli/cli-decode.h"
-
-/* User interface for reverse debugging:
-   Set exec-direction / show exec-direction commands (returns error 
-   unless target implements to_set_exec_direction method).  */
-
-static const char exec_forward[] = "forward";
-static const char exec_reverse[] = "reverse";
-static const char *exec_direction = exec_forward;
-static const char *exec_direction_names[] = {
-  exec_forward,
-  exec_reverse,
-  NULL
-};
-
-static void
-set_exec_direction_func (char *args, int from_tty,
-                        struct cmd_list_element *cmd)
-{
-  if (target_get_execution_direction () != EXEC_ERROR)
-    {
-      enum exec_direction_kind dir = EXEC_ERROR;
-
-      if (!strcmp (exec_direction, exec_forward))
-       dir = EXEC_FORWARD;
-      else if (!strcmp (exec_direction, exec_reverse))
-       dir = EXEC_REVERSE;
-
-      if (target_set_execution_direction (dir) != EXEC_ERROR)
-       return;
-    }
-}
-
-static void
-show_exec_direction_func (struct ui_file *out, int from_tty,
-                         struct cmd_list_element *cmd, const char *value)
-{
-  enum exec_direction_kind dir = target_get_execution_direction ();
-
-  switch (dir) {
-  case EXEC_FORWARD:
-    fprintf_filtered (out, _("Forward\n"));
-    break;
-  case EXEC_REVERSE:
-    fprintf_filtered (out, _("Reverse\n"));
-    break;
-  case EXEC_ERROR:
-  default:
-    fprintf_filtered,  (out, 
-                       _("Forward (target `%s' does not support exec-direction)\n"),
-                       target_shortname);
-    break;
-  }
-}
+#include "inferior.h"
 
 /* User interface:
-   reverse-step, reverse-next etc. (returns error unles 
-   target implements to_set_exec_direction method).  */
+   reverse-step, reverse-next etc.  */
 
 static void exec_direction_default (void *notused)
 {
   /* Return execution direction to default state.  */
-  target_set_execution_direction (EXEC_FORWARD);
+  execution_direction = EXEC_FORWARD;
 }
 
 /* exec_reverse_once -- accepts an arbitrary gdb command (string), 
@@ -99,7 +46,7 @@ exec_reverse_once (char *cmd, char *args, int from_tty)
 {
   /* String buffer for command consing.  */
   char reverse_command[512];
-  enum exec_direction_kind dir = target_get_execution_direction ();
+  enum exec_direction_kind dir = execution_direction;
   struct cleanup *old_chain;
 
   if (dir == EXEC_ERROR)
@@ -109,11 +56,13 @@ exec_reverse_once (char *cmd, char *args, int from_tty)
     error (_("Already in reverse mode.  Use '%s' or 'set exec-dir forward'."),
           cmd);
 
-  if (target_set_execution_direction (EXEC_REVERSE) == EXEC_ERROR)
+  if (!target_can_execute_reverse)
     error (_("Target %s does not support this command."), target_shortname);
 
   old_chain = make_cleanup (exec_direction_default, NULL);
   sprintf (reverse_command, "%s %s", cmd, args ? args : "");
+
+  execution_direction = EXEC_REVERSE;
   execute_command (reverse_command, from_tty);
   do_cleanups (old_chain);
 }
@@ -157,14 +106,6 @@ reverse_finish (char *args, int from_tty)
 void
 _initialize_reverse (void)
 {
-  add_setshow_enum_cmd ("exec-direction", class_run, exec_direction_names,
-                       &exec_direction, _("Set direction of execution.\n\
-Options are 'forward' or 'reverse'."),
-                       _("Show direction of execution (forward/reverse)."),
-                       _("Tells gdb whether to execute forward or backward."),
-                       set_exec_direction_func, show_exec_direction_func,
-                       &setlist, &showlist);
-
   add_com ("reverse-step", class_run, reverse_step, _("\
 Step program backward until it reaches the beginning of another source line.\n\
 Argument N means do this N times (or till program stops for another reason).")
index f23d2a81691f8f147f220ba2bcd0994a4d5d0fa5..03b1cecaf4867f145295bf0456704d463637f308 100644 (file)
@@ -465,8 +465,7 @@ update_current_target (void)
       INHERIT (to_find_memory_regions, t);
       INHERIT (to_make_corefile_notes, t);
       INHERIT (to_get_thread_local_address, t);
-      INHERIT (to_get_exec_direction, t);
-      INHERIT (to_set_exec_direction, t);
+      INHERIT (to_can_execute_reverse, t);
       /* Do not inherit to_read_description.  */
       /* Do not inherit to_search_memory.  */
       INHERIT (to_magic, t);
index 798d872fac7cdde3e0c0f1c9f7f3ab47d379b96c..fbf9898f45170ef2fd8537bc8650655125878b52 100644 (file)
@@ -152,14 +152,6 @@ struct target_waitstatus
     value;
   };
 
-/* Reverse execution.  */
-enum exec_direction_kind
-  {
-    EXEC_FORWARD,
-    EXEC_REVERSE,
-    EXEC_ERROR
-  };
-
 /* Possible types of events that the inferior handler will have to
    deal with.  */
 enum inferior_event_type
@@ -536,10 +528,8 @@ struct target_ops
                             const gdb_byte *pattern, ULONGEST pattern_len,
                             CORE_ADDR *found_addrp);
 
-    /* Set execution direction (forward/reverse).  */
-    int (*to_set_exec_direction) (enum exec_direction_kind);
-    /* Get execution direction (forward/reverse).  */
-    enum exec_direction_kind (*to_get_exec_direction) (void);
+    /* Can target execute in reverse?  */
+    int (*to_can_execute_reverse) ();
 
     /* Default value is 0. Mean that this target doesn't support record wait.
        Need the help of infrun.c(handle_inferior_event). Set to 1 if this
@@ -1150,17 +1140,10 @@ extern int target_stopped_data_address_p (struct target_ops *);
 #define target_watchpoint_addr_within_range(target, addr, start, length) \
   (*target.to_watchpoint_addr_within_range) (target, addr, start, length)
 
-/* Forward/reverse execution direction.
-   These will only be implemented by a target that supports reverse execution.
-*/
-#define target_get_execution_direction() \
-    (current_target.to_get_exec_direction ? \
-     (*current_target.to_get_exec_direction) () : EXEC_ERROR)
-
-#define target_set_execution_direction(DIR) \
-    (current_target.to_set_exec_direction ? \
-     (*current_target.to_set_exec_direction) (DIR) : EXEC_ERROR)
-
+/* Target can execute in reverse?  */
+#define target_can_execute_reverse \
+     (current_target.to_can_execute_reverse ? \
+      current_target.to_can_execute_reverse () : 0)
 
 extern const struct target_desc *target_read_description (struct target_ops *);