summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@specifix.com>2008-10-08 00:26:28 +0000
committerMichael Snyder <msnyder@specifix.com>2008-10-08 00:26:28 +0000
commitd7e79454c7a67fa587142e6df9b89e9dc95c6c78 (patch)
tree433c0c26c2ca515b09b2d520936d2253b50157b0
parent89d6f80a812e411693cb6144eb00d9cab45bbb8d (diff)
downloadgdb-d7e79454c7a67fa587142e6df9b89e9dc95c6c78.tar.gz
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.
-rw-r--r--gdb/ChangeLog37
-rw-r--r--gdb/infcmd.c6
-rw-r--r--gdb/inferior.h10
-rw-r--r--gdb/infrun.c71
-rw-r--r--gdb/record.c46
-rw-r--r--gdb/record.h6
-rw-r--r--gdb/remote.c34
-rw-r--r--gdb/reverse.c73
-rw-r--r--gdb/target.c3
-rw-r--r--gdb/target.h29
10 files changed, 148 insertions, 167 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index f02450f8fb2..9c3355c24fd 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,42 @@
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.
(stepped_into_function_backward):
Rename handle_step_into_function_backward.
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index f1329fbb2b1..131f4af8263 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -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);
diff --git a/gdb/inferior.h b/gdb/inferior.h
index 43f902238ff..8b03b63d18b 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -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. */
diff --git a/gdb/infrun.c b/gdb/infrun.c
index db3eb4d98d5..1449b076ff2 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -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)
}
+/* 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);
diff --git a/gdb/record.c b/gdb/record.c
index 1df9dbda80f..626edaceb0b 100644
--- a/gdb/record.c
+++ b/gdb/record.c
@@ -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;
}
diff --git a/gdb/record.h b/gdb/record.h
index 1931b4fcfd7..39241e6140e 100644
--- a/gdb/record.h
+++ b/gdb/record.h
@@ -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);
diff --git a/gdb/remote.c b/gdb/remote.c
index 571179e079b..6d9ef0bd3de 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -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;
diff --git a/gdb/reverse.c b/gdb/reverse.c
index 320913ff61e..ee6567586e0 100644
--- a/gdb/reverse.c
+++ b/gdb/reverse.c
@@ -25,68 +25,15 @@
#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).")
diff --git a/gdb/target.c b/gdb/target.c
index f23d2a81691..03b1cecaf48 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -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);
diff --git a/gdb/target.h b/gdb/target.h
index 798d872fac7..fbf9898f451 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -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 *);