• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


コミットメタ情報

リビジョンefb0ddc166fc1b07a0c4564bf75b8c1c8584b1ab (tree)
日時2008-10-08 09:26:50
作者Michael Snyder <msnyder@vmwa...>
コミッターMichael Snyder

ログメッセージ

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.

変更サマリ

差分

--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,42 @@
11 2008-10-07 Michael Snyder <msnyder@vmware.com>
22
3+ * target.h (to_set_exec_direction, to_get_exec_direction): Remove.
4+ (to_can_execute_reverse): New method.
5+ (enum exec_direction_kind): Move to inferior.h.
6+ * target.c (update_current_target): Inherit to_can_execute_reverse.
7+ Remove to_set_exec_direction, to_get_exec_direction.
8+ * inferior.h (enum exec_direction_kind): Move from target.h.
9+
10+ * infrun.c (set_exec_direction_func): Move here from reverse.c.
11+ (show_exec_direction_func): Ditto.
12+ (proceed): Consult global execution_direction instead of
13+ target method.
14+ (handle_inferior_event): Ditto.
15+
16+ * reverse.c (set_exec_direction_func): Move to infrun.c
17+ (show_exec_direction_func): Ditto.
18+ (exec_direction_default): Set infrun global variable.
19+ (exec_reverse_once): Consult infrun global direction variable.
20+
21+ * infcmd.c (step_1): Consult infrun global direction variable.
22+ (step_once): Ditto.
23+ (until_next_command): Ditto.
24+ (finish_command): Ditto.
25+
26+ * record.h (record_exec_direction): Delete.
27+ (RECORD_IS_REPLAY): Consult infrun global direction variable.
28+
29+ * record.c: (record_wait_cleanups): Use infrun state variable.
30+ (record_wait): Ditto.
31+ (record_get_exec_direction, record_set_exec_direction): Remove.
32+ (record_can_execute_reverse): New target method.
33+
34+ * remote.c (remote_resume): Use infrun state variable.
35+ (remote_get_exec_direction, remote_set_exec_direction): Remove.
36+ (remote_can_execute_reverse): New target method.
37+
38+2008-10-07 Michael Snyder <msnyder@vmware.com>
39+
340 * infrun.c (stepped_into_function): Rename handle_step_into_function.
441 (stepped_into_function_backward):
542 Rename handle_step_into_function_backward.
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -824,7 +824,7 @@ step_1 (int skip_subroutines, int single_inst, char *count_string)
824824 error (_("No current frame"));
825825 step_frame_id = get_frame_id (frame);
826826
827- if (target_get_execution_direction () == EXEC_REVERSE)
827+ if (execution_direction == EXEC_REVERSE)
828828 {
829829 frame = get_prev_frame (frame);
830830 if (frame)
@@ -942,7 +942,7 @@ step_once (int skip_subroutines, int single_inst, int count, int thread)
942942 error (_("No current frame"));
943943 step_frame_id = get_frame_id (frame);
944944
945- if (target_get_execution_direction () == EXEC_REVERSE)
945+ if (execution_direction == EXEC_REVERSE)
946946 {
947947 frame = get_prev_frame (frame);
948948 if (frame)
@@ -1221,7 +1221,7 @@ until_next_command (int from_tty)
12211221 step_over_calls = STEP_OVER_ALL;
12221222 step_frame_id = get_frame_id (frame);
12231223
1224- if (target_get_execution_direction () == EXEC_REVERSE)
1224+ if (execution_direction == EXEC_REVERSE)
12251225 {
12261226 frame = get_prev_frame (frame);
12271227 if (frame)
@@ -1501,7 +1501,7 @@ finish_command (char *arg, int from_tty)
15011501 error (_("Asynchronous execution not supported on this target."));
15021502
15031503 /* Don't try to async in reverse. */
1504- if (async_exec && target_get_execution_direction () == EXEC_REVERSE)
1504+ if (async_exec && execution_direction == EXEC_REVERSE)
15051505 error (_("Asynchronous 'finish' not supported in reverse."));
15061506
15071507 /* If we are not asked to run in the bg, then prepare to run in the
@@ -1531,7 +1531,7 @@ finish_command (char *arg, int from_tty)
15311531 source. */
15321532 if (from_tty)
15331533 {
1534- if (target_get_execution_direction () == EXEC_REVERSE)
1534+ if (execution_direction == EXEC_REVERSE)
15351535 printf_filtered (_("Run back to call of "));
15361536 else
15371537 printf_filtered (_("Run till exit from "));
@@ -1539,7 +1539,7 @@ finish_command (char *arg, int from_tty)
15391539 print_stack_frame (get_selected_frame (NULL), 1, LOCATION);
15401540 }
15411541
1542- if (target_get_execution_direction () == EXEC_REVERSE)
1542+ if (execution_direction == EXEC_REVERSE)
15431543 {
15441544 /* Split off at this point. */
15451545 finish_backward (function);
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -386,6 +386,16 @@ enum stop_kind
386386
387387 extern enum stop_kind stop_soon;
388388
389+/* Reverse execution. */
390+enum exec_direction_kind
391+ {
392+ EXEC_FORWARD,
393+ EXEC_REVERSE,
394+ EXEC_ERROR
395+ };
396+
397+extern enum exec_direction_kind execution_direction;
398+
389399 /* Nonzero if proceed is being used for a "finish" command or a similar
390400 situation when stop_registers should be saved. */
391401
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -1223,7 +1223,7 @@ proceed (CORE_ADDR addr, enum target_signal siggnal, int step)
12231223 if (addr == (CORE_ADDR) -1)
12241224 {
12251225 if (pc == stop_pc && breakpoint_here_p (pc)
1226- && target_get_execution_direction () != EXEC_REVERSE)
1226+ && execution_direction != EXEC_REVERSE)
12271227 /* There is a breakpoint at the address we will resume at,
12281228 step one instruction before inserting breakpoints so that
12291229 we do not stop right away (and report a second hit at this
@@ -2642,7 +2642,7 @@ targets should add new threads to the thread list themselves in non-stop mode.")
26422642 = !(bpstat_explains_signal (stop_bpstat)
26432643 || stepping_over_breakpoint
26442644 || (step_range_end && step_resume_breakpoint == NULL)
2645- || (target_get_execution_direction () == EXEC_REVERSE)
2645+ || (execution_direction == EXEC_REVERSE)
26462646 || RECORD_IS_USED);
26472647 else
26482648 {
@@ -2882,7 +2882,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (!gdbarch_get_longjmp_target)\n");
28822882 return;
28832883 }
28842884 if (stop_pc == ecs->stop_func_start
2885- && target_get_execution_direction () == EXEC_REVERSE)
2885+ && execution_direction == EXEC_REVERSE)
28862886 {
28872887 /* We are stepping over a function call in reverse, and
28882888 just hit the step-resume breakpoint at the start
@@ -3063,7 +3063,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (!gdbarch_get_longjmp_target)\n");
30633063 keep going back to the call point). */
30643064 if (stop_pc == step_range_start
30653065 && stop_pc != ecs->stop_func_start
3066- && target_get_execution_direction () == EXEC_REVERSE)
3066+ && execution_direction == EXEC_REVERSE)
30673067 {
30683068 stop_step = 1;
30693069 print_stop_reason (END_STEPPING_RANGE, 0);
@@ -3172,7 +3172,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (!gdbarch_get_longjmp_target)\n");
31723172 get there, we'll need to single-step back to the
31733173 caller. */
31743174
3175- if (target_get_execution_direction () == EXEC_REVERSE)
3175+ if (execution_direction == EXEC_REVERSE)
31763176 {
31773177 if (ecs->stop_func_start == 0)
31783178 {
@@ -3244,7 +3244,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (!gdbarch_get_longjmp_target)\n");
32443244 tmp_sal = find_pc_line (ecs->stop_func_start, 0);
32453245 if (tmp_sal.line != 0)
32463246 {
3247- if (target_get_execution_direction () == EXEC_REVERSE)
3247+ if (execution_direction == EXEC_REVERSE)
32483248 handle_step_into_function_backward (ecs);
32493249 else
32503250 handle_step_into_function (ecs);
@@ -3263,7 +3263,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (!gdbarch_get_longjmp_target)\n");
32633263 return;
32643264 }
32653265
3266- if (target_get_execution_direction () == EXEC_REVERSE)
3266+ if (execution_direction == EXEC_REVERSE)
32673267 {
32683268 /* Set a breakpoint at callee's start address.
32693269 From there we can step once and be back in the caller. */
@@ -3407,7 +3407,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (!gdbarch_get_longjmp_target)\n");
34073407 if (debug_infrun)
34083408 fprintf_unfiltered (gdb_stdlog, "infrun: no line number info\n");
34093409
3410- if (target_get_execution_direction () == EXEC_REVERSE)
3410+ if (execution_direction == EXEC_REVERSE)
34113411 {
34123412 /* Set a breakpoint at callee's start address.
34133413 From there we can step once and be back in the caller. */
@@ -3446,7 +3446,7 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (!gdbarch_get_longjmp_target)\n");
34463446 return;
34473447 }
34483448
3449- if (target_get_execution_direction () == EXEC_REVERSE
3449+ if (execution_direction == EXEC_REVERSE
34503450 && frame_id_eq (get_frame_id (get_current_frame ()),
34513451 step_prev_frame_id))
34523452 {
@@ -3462,11 +3462,11 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (!gdbarch_get_longjmp_target)\n");
34623462 }
34633463
34643464 if (!frame_id_eq (get_frame_id (get_current_frame ()), step_frame_id)
3465- && (target_get_execution_direction () == EXEC_REVERSE
3465+ && (execution_direction == EXEC_REVERSE
34663466 || RECORD_IS_USED))
34673467 {
34683468 if (stop_pc != stop_pc_sal.pc
3469- && target_get_execution_direction () == EXEC_REVERSE
3469+ && execution_direction == EXEC_REVERSE
34703470 && step_over_calls == STEP_OVER_ALL)
34713471 {
34723472 if (debug_infrun)
@@ -3489,9 +3489,9 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (!gdbarch_get_longjmp_target)\n");
34893489 }
34903490 #if 0
34913491 if (((stop_pc == stop_pc_sal.pc
3492- && target_get_execution_direction () != EXEC_REVERSE)
3492+ && execution_direction != EXEC_REVERSE)
34933493 || (stop_pc >= stop_pc_sal.pc && stop_pc < stop_pc_sal.end
3494- && target_get_execution_direction () == EXEC_REVERSE))
3494+ && execution_direction == EXEC_REVERSE))
34953495 && (tss->current_line != stop_pc_sal.line
34963496 || tss->current_symtab != stop_pc_sal.symtab))
34973497 {
@@ -4917,6 +4917,55 @@ save_inferior_ptid (void)
49174917 }
49184918
49194919
4920+/* User interface for reverse debugging:
4921+ Set exec-direction / show exec-direction commands
4922+ (returns error unless target implements to_set_exec_direction method). */
4923+
4924+enum exec_direction_kind execution_direction = EXEC_FORWARD;
4925+static const char exec_forward[] = "forward";
4926+static const char exec_reverse[] = "reverse";
4927+static const char *exec_direction = exec_forward;
4928+static const char *exec_direction_names[] = {
4929+ exec_forward,
4930+ exec_reverse,
4931+ NULL
4932+};
4933+
4934+static void
4935+set_exec_direction_func (char *args, int from_tty,
4936+ struct cmd_list_element *cmd)
4937+{
4938+ if (target_can_execute_reverse)
4939+ {
4940+ if (!strcmp (exec_direction, exec_forward))
4941+ execution_direction = EXEC_FORWARD;
4942+ else if (!strcmp (exec_direction, exec_reverse))
4943+ execution_direction = EXEC_REVERSE;
4944+ }
4945+}
4946+
4947+static void
4948+show_exec_direction_func (struct ui_file *out, int from_tty,
4949+ struct cmd_list_element *cmd, const char *value)
4950+{
4951+ switch (execution_direction) {
4952+ case EXEC_FORWARD:
4953+ fprintf_filtered (out, _("Forward.\n"));
4954+ break;
4955+ case EXEC_REVERSE:
4956+ fprintf_filtered (out, _("Reverse.\n"));
4957+ break;
4958+ case EXEC_ERROR:
4959+ default:
4960+ fprintf_filtered (out,
4961+ _("Forward (target `%s' does not support exec-direction).\n"),
4962+ target_shortname);
4963+ break;
4964+ }
4965+}
4966+
4967+/* User interface for non-stop mode. */
4968+
49204969 int non_stop = 0;
49214970 static int non_stop_1 = 0;
49224971
@@ -5142,6 +5191,14 @@ breakpoints, even if such is supported by the target."),
51425191 &maintenance_set_cmdlist,
51435192 &maintenance_show_cmdlist);
51445193
5194+ add_setshow_enum_cmd ("exec-direction", class_run, exec_direction_names,
5195+ &exec_direction, _("Set direction of execution.\n\
5196+Options are 'forward' or 'reverse'."),
5197+ _("Show direction of execution (forward/reverse)."),
5198+ _("Tells gdb whether to execute forward or backward."),
5199+ set_exec_direction_func, show_exec_direction_func,
5200+ &setlist, &showlist);
5201+
51455202 /* ptid initializations */
51465203 null_ptid = ptid_build (0, 0, 0);
51475204 minus_one_ptid = ptid_build (-1, 0, 0);
--- a/gdb/record.c
+++ b/gdb/record.c
@@ -44,7 +44,6 @@ static int record_insn_num = 0;
4444
4545 struct target_ops record_ops;
4646 int record_resume_step = 0;
47-enum exec_direction_kind record_exec_direction = EXEC_FORWARD;
4847 static int record_get_sig = 0;
4948 static sigset_t record_maskall;
5049 static int record_not_record = 0;
@@ -416,7 +415,6 @@ record_open (char *name, int from_tty)
416415
417416 /* Reset */
418417 record_insn_num = 0;
419- record_exec_direction = EXEC_FORWARD;
420418 record_list = &record_first;
421419 record_list->next = NULL;
422420
@@ -459,7 +457,7 @@ record_sig_handler (int signo)
459457 static void
460458 record_wait_cleanups (void *ignore)
461459 {
462- if (record_exec_direction == EXEC_REVERSE)
460+ if (execution_direction == EXEC_REVERSE)
463461 {
464462 if (record_list->next)
465463 {
@@ -517,7 +515,7 @@ record_wait (ptid_t ptid, struct target_waitstatus *status)
517515
518516 /* In EXEC_FORWARD mode, record_list point to the tail of prev
519517 instruction. */
520- if (record_exec_direction == EXEC_FORWARD && record_list->next)
518+ if (execution_direction == EXEC_FORWARD && record_list->next)
521519 {
522520 record_list = record_list->next;
523521 }
@@ -528,14 +526,14 @@ record_wait (ptid_t ptid, struct target_waitstatus *status)
528526 do
529527 {
530528 /* Check for beginning and end of log. */
531- if (record_exec_direction == EXEC_REVERSE
529+ if (execution_direction == EXEC_REVERSE
532530 && record_list == &record_first)
533531 {
534532 /* Hit beginning of record log in reverse. */
535533 status->kind = TARGET_WAITKIND_NO_HISTORY;
536534 break;
537535 }
538- if (record_exec_direction != EXEC_REVERSE && !record_list->next)
536+ if (execution_direction != EXEC_REVERSE && !record_list->next)
539537 {
540538 /* Hit end of record log going forward. */
541539 status->kind = TARGET_WAITKIND_NO_HISTORY;
@@ -603,7 +601,7 @@ record_wait (ptid_t ptid, struct target_waitstatus *status)
603601 record_list->u.need_dasm);
604602 }
605603
606- if (record_exec_direction == EXEC_FORWARD)
604+ if (execution_direction == EXEC_FORWARD)
607605 {
608606 need_dasm = record_list->u.need_dasm;
609607 }
@@ -612,7 +610,7 @@ record_wait (ptid_t ptid, struct target_waitstatus *status)
612610 gdbarch_record_dasm (current_gdbarch);
613611 }
614612
615- if (first_record_end && record_exec_direction == EXEC_REVERSE)
613+ if (first_record_end && execution_direction == EXEC_REVERSE)
616614 {
617615 /* When reverse excute, the first record_end is the part of
618616 current instruction. */
@@ -666,7 +664,7 @@ record_wait (ptid_t ptid, struct target_waitstatus *status)
666664 }
667665 }
668666 }
669- if (record_exec_direction == EXEC_REVERSE)
667+ if (execution_direction == EXEC_REVERSE)
670668 {
671669 need_dasm = record_list->u.need_dasm;
672670 }
@@ -675,7 +673,7 @@ record_wait (ptid_t ptid, struct target_waitstatus *status)
675673 next:
676674 if (continue_flag)
677675 {
678- if (record_exec_direction == EXEC_REVERSE)
676+ if (execution_direction == EXEC_REVERSE)
679677 {
680678 if (record_list->prev)
681679 record_list = record_list->prev;
@@ -951,29 +949,10 @@ record_remove_breakpoint (struct bp_target_info *bp_tgt)
951949 return 0;
952950 }
953951
954-static enum exec_direction_kind
955-record_get_exec_direction (void)
956-{
957- if (record_debug > 1)
958- printf_filtered ("Process record: exec_direction is %s\n",
959- record_exec_direction == EXEC_FORWARD ? "forward" :
960- record_exec_direction == EXEC_REVERSE ? "reverse" : "unknown");
961- return record_exec_direction;
962-}
963-
964952 static int
965-record_set_exec_direction (enum exec_direction_kind dir)
953+record_can_execute_reverse (void)
966954 {
967- if (record_debug)
968- printf_filtered ("Process record: set exec_direction: %s\n",
969- dir == EXEC_FORWARD ? "forward" :
970- dir == EXEC_REVERSE ? "reverse" : "bad direction");
971-
972- /* FIXME: check target for capability. */
973- if (dir == EXEC_FORWARD || dir == EXEC_REVERSE)
974- return (record_exec_direction = dir);
975- else
976- return EXEC_ERROR;
955+ return 1;
977956 }
978957
979958 static void
@@ -996,8 +975,7 @@ init_record_ops (void)
996975 record_ops.to_xfer_partial = record_xfer_partial;
997976 record_ops.to_insert_breakpoint = record_insert_breakpoint;
998977 record_ops.to_remove_breakpoint = record_remove_breakpoint;
999- record_ops.to_get_exec_direction = record_get_exec_direction;
1000- record_ops.to_set_exec_direction = record_set_exec_direction;
978+ record_ops.to_can_execute_reverse = record_can_execute_reverse;
1001979 record_ops.to_stratum = record_stratum;
1002980 record_ops.to_magic = OPS_MAGIC;
1003981 }
@@ -1131,7 +1109,6 @@ _initialize_record (void)
11311109 add_com_alias ("sr", "stoprecord", class_obscure, 1);
11321110
11331111 /* Record instructions number limit command. */
1134- /* Teawater -- tell me if I got this one wrong. MVS */
11351112 add_setshow_zinteger_cmd ("record-auto-delete", no_class,
11361113 &record_insn_max_mode,
11371114 _("Set record/replay auto delete mode."),
--- a/gdb/record.h
+++ b/gdb/record.h
@@ -23,7 +23,7 @@
2323 #define RECORD_IS_USED \
2424 (current_target.beneath == &record_ops)
2525 #define RECORD_IS_REPLAY \
26- (record_list->next || record_exec_direction == EXEC_REVERSE)
26+ (record_list->next || execution_direction == EXEC_REVERSE)
2727 #define RECORD_TARGET_SUPPORT_RECORD_WAIT \
2828 (record_ops.beneath->to_support_record_wait)
2929
@@ -78,7 +78,6 @@ extern struct regcache *record_regcache;
7878
7979 extern struct target_ops record_ops;
8080 extern int record_resume_step;
81-extern enum exec_direction_kind record_exec_direction;
8281
8382 extern int record_arch_list_add_reg (int num);
8483 extern int record_arch_list_add_mem (CORE_ADDR addr, int len);
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -3210,7 +3210,7 @@ remote_resume (ptid_t ptid, int step, enum target_signal siggnal)
32103210 set_continue_thread (ptid);
32113211
32123212 buf = rs->buf;
3213- if (target_get_execution_direction () == EXEC_REVERSE)
3213+ if (execution_direction == EXEC_REVERSE)
32143214 {
32153215 /* We don't pass signals to the target in reverse exec mode. */
32163216 if (info_verbose && siggnal != TARGET_SIGNAL_0)
@@ -7131,34 +7131,12 @@ remote_command (char *args, int from_tty)
71317131 help_list (remote_cmdlist, "remote ", -1, gdb_stdout);
71327132 }
71337133
7134-/* Reverse execution.
7135- FIXME: set up as a capability. */
7136-static enum exec_direction_kind remote_exec_direction = EXEC_FORWARD;
7134+static int remote_target_can_reverse = 1;
71377135
7138-static enum exec_direction_kind
7139-remote_get_exec_direction (void)
7140-{
7141- if (remote_debug && info_verbose)
7142- printf_filtered ("remote exec_direction is %s\n",
7143- remote_exec_direction == EXEC_FORWARD ? _("forward") :
7144- remote_exec_direction == EXEC_REVERSE ? _("reverse") :
7145- _("unknown"));
7146- return remote_exec_direction;
7147-}
7148-
7149-static int remote_set_exec_direction (enum exec_direction_kind dir)
7136+static int
7137+remote_can_execute_reverse (void)
71507138 {
7151- if (remote_debug && info_verbose)
7152- printf_filtered ("Set remote exec_direction: %s\n",
7153- dir == EXEC_FORWARD ? _("forward") :
7154- dir == EXEC_REVERSE ? _("reverse") :
7155- _("bad direction"));
7156-
7157- /* FIXME: check target for capability. */
7158- if (dir == EXEC_FORWARD || dir == EXEC_REVERSE)
7159- return (remote_exec_direction = dir);
7160- else
7161- return EXEC_ERROR;
7139+ return remote_target_can_reverse;
71627140 }
71637141
71647142 static void
@@ -7209,8 +7187,7 @@ Specify the serial device it is connected to\n\
72097187 remote_ops.to_has_registers = 1;
72107188 remote_ops.to_has_execution = 1;
72117189 remote_ops.to_has_thread_control = tc_schedlock; /* can lock scheduler */
7212- remote_ops.to_get_exec_direction = remote_get_exec_direction;
7213- remote_ops.to_set_exec_direction = remote_set_exec_direction;
7190+ remote_ops.to_can_execute_reverse = remote_can_execute_reverse;
72147191 remote_ops.to_magic = OPS_MAGIC;
72157192 remote_ops.to_memory_map = remote_memory_map;
72167193 remote_ops.to_flash_erase = remote_flash_erase;
--- a/gdb/reverse.c
+++ b/gdb/reverse.c
@@ -25,68 +25,15 @@
2525 #include "top.h"
2626 #include "cli/cli-cmds.h"
2727 #include "cli/cli-decode.h"
28-
29-/* User interface for reverse debugging:
30- Set exec-direction / show exec-direction commands
31- (returns error unless target implements to_set_exec_direction method). */
32-
33-static const char exec_forward[] = "forward";
34-static const char exec_reverse[] = "reverse";
35-static const char *exec_direction = exec_forward;
36-static const char *exec_direction_names[] = {
37- exec_forward,
38- exec_reverse,
39- NULL
40-};
41-
42-static void
43-set_exec_direction_func (char *args, int from_tty,
44- struct cmd_list_element *cmd)
45-{
46- if (target_get_execution_direction () != EXEC_ERROR)
47- {
48- enum exec_direction_kind dir = EXEC_ERROR;
49-
50- if (!strcmp (exec_direction, exec_forward))
51- dir = EXEC_FORWARD;
52- else if (!strcmp (exec_direction, exec_reverse))
53- dir = EXEC_REVERSE;
54-
55- if (target_set_execution_direction (dir) != EXEC_ERROR)
56- return;
57- }
58-}
59-
60-static void
61-show_exec_direction_func (struct ui_file *out, int from_tty,
62- struct cmd_list_element *cmd, const char *value)
63-{
64- enum exec_direction_kind dir = target_get_execution_direction ();
65-
66- switch (dir) {
67- case EXEC_FORWARD:
68- fprintf_filtered (out, _("Forward.\n"));
69- break;
70- case EXEC_REVERSE:
71- fprintf_filtered (out, _("Reverse.\n"));
72- break;
73- case EXEC_ERROR:
74- default:
75- fprintf_filtered (out,
76- _("Forward (target `%s' does not support exec-direction).\n"),
77- target_shortname);
78- break;
79- }
80-}
28+#include "inferior.h"
8129
8230 /* User interface:
83- reverse-step, reverse-next etc.
84- (returns error unles target implements to_set_exec_direction method). */
31+ reverse-step, reverse-next etc. */
8532
8633 static void exec_direction_default (void *notused)
8734 {
8835 /* Return execution direction to default state. */
89- target_set_execution_direction (EXEC_FORWARD);
36+ execution_direction = EXEC_FORWARD;
9037 }
9138
9239 /* exec_reverse_once -- accepts an arbitrary gdb command (string),
@@ -99,7 +46,7 @@ exec_reverse_once (char *cmd, char *args, int from_tty)
9946 {
10047 /* String buffer for command consing. */
10148 char reverse_command[512];
102- enum exec_direction_kind dir = target_get_execution_direction ();
49+ enum exec_direction_kind dir = execution_direction;
10350 struct cleanup *old_chain;
10451
10552 if (dir == EXEC_ERROR)
@@ -109,11 +56,13 @@ exec_reverse_once (char *cmd, char *args, int from_tty)
10956 error (_("Already in reverse mode. Use '%s' or 'set exec-dir forward'."),
11057 cmd);
11158
112- if (target_set_execution_direction (EXEC_REVERSE) == EXEC_ERROR)
59+ if (!target_can_execute_reverse)
11360 error (_("Target %s does not support this command."), target_shortname);
11461
11562 old_chain = make_cleanup (exec_direction_default, NULL);
11663 sprintf (reverse_command, "%s %s", cmd, args ? args : "");
64+
65+ execution_direction = EXEC_REVERSE;
11766 execute_command (reverse_command, from_tty);
11867 do_cleanups (old_chain);
11968 }
@@ -157,14 +106,6 @@ reverse_finish (char *args, int from_tty)
157106 void
158107 _initialize_reverse (void)
159108 {
160- add_setshow_enum_cmd ("exec-direction", class_run, exec_direction_names,
161- &exec_direction, _("Set direction of execution.\n\
162-Options are 'forward' or 'reverse'."),
163- _("Show direction of execution (forward/reverse)."),
164- _("Tells gdb whether to execute forward or backward."),
165- set_exec_direction_func, show_exec_direction_func,
166- &setlist, &showlist);
167-
168109 add_com ("reverse-step", class_run, reverse_step, _("\
169110 Step program backward until it reaches the beginning of another source line.\n\
170111 Argument N means do this N times (or till program stops for another reason).")
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -486,8 +486,7 @@ update_current_target (void)
486486 INHERIT (to_find_memory_regions, t);
487487 INHERIT (to_make_corefile_notes, t);
488488 INHERIT (to_get_thread_local_address, t);
489- INHERIT (to_get_exec_direction, t);
490- INHERIT (to_set_exec_direction, t);
489+ INHERIT (to_can_execute_reverse, t);
491490 /* Do not inherit to_read_description. */
492491 /* Do not inherit to_search_memory. */
493492 INHERIT (to_magic, t);
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -152,14 +152,6 @@ struct target_waitstatus
152152 value;
153153 };
154154
155-/* Reverse execution. */
156-enum exec_direction_kind
157- {
158- EXEC_FORWARD,
159- EXEC_REVERSE,
160- EXEC_ERROR
161- };
162-
163155 /* Possible types of events that the inferior handler will have to
164156 deal with. */
165157 enum inferior_event_type
@@ -535,10 +527,8 @@ struct target_ops
535527 const gdb_byte *pattern, ULONGEST pattern_len,
536528 CORE_ADDR *found_addrp);
537529
538- /* Set execution direction (forward/reverse). */
539- int (*to_set_exec_direction) (enum exec_direction_kind);
540- /* Get execution direction (forward/reverse). */
541- enum exec_direction_kind (*to_get_exec_direction) (void);
530+ /* Can target execute in reverse? */
531+ int (*to_can_execute_reverse) ();
542532
543533 /* Default value is 0. Mean that this target doesn't support record wait.
544534 Need the help of infrun.c(handle_inferior_event). Set to 1 if this
@@ -1143,17 +1133,10 @@ extern int target_stopped_data_address_p (struct target_ops *);
11431133 #define target_watchpoint_addr_within_range(target, addr, start, length) \
11441134 (*target.to_watchpoint_addr_within_range) (target, addr, start, length)
11451135
1146-/* Forward/reverse execution direction.
1147- These will only be implemented by a target that supports reverse execution.
1148-*/
1149-#define target_get_execution_direction() \
1150- (current_target.to_get_exec_direction ? \
1151- (*current_target.to_get_exec_direction) () : EXEC_ERROR)
1152-
1153-#define target_set_execution_direction(DIR) \
1154- (current_target.to_set_exec_direction ? \
1155- (*current_target.to_set_exec_direction) (DIR) : EXEC_ERROR)
1156-
1136+/* Target can execute in reverse? */
1137+#define target_can_execute_reverse \
1138+ (current_target.to_can_execute_reverse ? \
1139+ current_target.to_can_execute_reverse () : 0)
11571140
11581141 extern const struct target_desc *target_read_description (struct target_ops *);
11591142