target: add to_record_stop_replaying target method
authorMarkus Metzger <markus.t.metzger@intel.com>
Tue, 8 Sep 2015 07:42:20 +0000 (09:42 +0200)
committerMarkus Metzger <markus.t.metzger@intel.com>
Fri, 18 Sep 2015 12:30:12 +0000 (14:30 +0200)
Add a new target method to_record_stop_replaying to stop replaying.

gdb/
* record-btrace.c (record_btrace_resume): Call
target_record_stop_replaying.
(record_btrace_stop_replaying_all): New.
(init_record_btrace_ops): Initialize to_record_stop_replaying.
* record-full.c (record_full_stop_replaying): New.
(init_record_full_ops ): Initialize to_record_stop_replaying.
* target-delegates.c: Regenerated.
* target.c (target_record_stop_replaying): New.
* target.h (struct target_ops) <to_record_stop_replaying>: New.
(target_record_stop_replaying): New.

gdb/ChangeLog
gdb/record-btrace.c
gdb/record-full.c
gdb/target-delegates.c
gdb/target.c
gdb/target.h

index 1c4922fc3d6a3ac9d519ff88d4453f8d66f7f31a..24ae06a96ff9a8897168280e6d7e3f5ad3760c34 100644 (file)
@@ -1,3 +1,16 @@
+2015-09-18  Markus Metzger  <markus.t.metzger@intel.com>
+
+       * record-btrace.c (record_btrace_resume): Call
+       target_record_stop_replaying.
+       (record_btrace_stop_replaying_all): New.
+       (init_record_btrace_ops): Initialize to_record_stop_replaying.
+       * record-full.c (record_full_stop_replaying): New.
+       (init_record_full_ops ): Initialize to_record_stop_replaying.
+       * target-delegates.c: Regenerated.
+       * target.c (target_record_stop_replaying): New.
+       * target.h (struct target_ops) <to_record_stop_replaying>: New.
+       (target_record_stop_replaying): New.
+
 2015-09-18  Markus Metzger  <markus.t.metzger@intel.com>
 
        * record-btrace.c (record_btrace_xfer_partial)
index b4e45602b3182bd2c31e6b28b2725c65a486f737..e0b79a882875867607e82ca0f443e1a4f734b58b 100644 (file)
@@ -1910,8 +1910,7 @@ record_btrace_resume (struct target_ops *ops, ptid_t ptid, int step,
       /* ...and we stop replaying other threads if the thread to resume is not
         replaying.  */
       if (!btrace_is_replaying (tp) && execution_direction != EXEC_REVERSE)
-       ALL_NON_EXITED_THREADS (tp)
-         record_btrace_stop_replaying (tp);
+       target_record_stop_replaying ();
     }
 
   /* As long as we're not replaying, just forward the request.
@@ -2596,6 +2595,17 @@ record_btrace_goto (struct target_ops *self, ULONGEST insn)
   record_btrace_set_replay (tp, &it);
 }
 
+/* The to_record_stop_replaying method of target record-btrace.  */
+
+static void
+record_btrace_stop_replaying_all (struct target_ops *self)
+{
+  struct thread_info *tp;
+
+  ALL_NON_EXITED_THREADS (tp)
+    record_btrace_stop_replaying (tp);
+}
+
 /* The to_execution_direction target method.  */
 
 static enum exec_direction_kind
@@ -2647,6 +2657,7 @@ init_record_btrace_ops (void)
   ops->to_call_history_from = record_btrace_call_history_from;
   ops->to_call_history_range = record_btrace_call_history_range;
   ops->to_record_is_replaying = record_btrace_is_replaying;
+  ops->to_record_stop_replaying = record_btrace_stop_replaying_all;
   ops->to_xfer_partial = record_btrace_xfer_partial;
   ops->to_remove_breakpoint = record_btrace_remove_breakpoint;
   ops->to_insert_breakpoint = record_btrace_insert_breakpoint;
index 03dc22d6a2db980a2e4762c20a6b2b7cc7553a5a..35b384115e9d819b2b3e67b6fc5ee648317c5ff4 100644 (file)
@@ -1917,6 +1917,14 @@ record_full_goto (struct target_ops *self, ULONGEST target_insn)
   record_full_goto_entry (p);
 }
 
+/* The "to_record_stop_replaying" target method.  */
+
+static void
+record_full_stop_replaying (struct target_ops *self)
+{
+  record_full_goto_end (self);
+}
+
 static void
 init_record_full_ops (void)
 {
@@ -1957,6 +1965,7 @@ init_record_full_ops (void)
   record_full_ops.to_save_record = record_full_save;
   record_full_ops.to_delete_record = record_full_delete;
   record_full_ops.to_record_is_replaying = record_full_is_replaying;
+  record_full_ops.to_record_stop_replaying = record_full_stop_replaying;
   record_full_ops.to_goto_record_begin = record_full_goto_begin;
   record_full_ops.to_goto_record_end = record_full_goto_end;
   record_full_ops.to_goto_record = record_full_goto;
index 9f909a0bfe40238c48a9636f10895aed2e286ab7..a07c8c9df257c41779f49ea2665d0ab8d3ee2a0a 100644 (file)
@@ -3630,6 +3630,28 @@ debug_record_is_replaying (struct target_ops *self, ptid_t arg1)
   return result;
 }
 
+static void
+delegate_record_stop_replaying (struct target_ops *self)
+{
+  self = self->beneath;
+  self->to_record_stop_replaying (self);
+}
+
+static void
+tdefault_record_stop_replaying (struct target_ops *self)
+{
+}
+
+static void
+debug_record_stop_replaying (struct target_ops *self)
+{
+  fprintf_unfiltered (gdb_stdlog, "-> %s->to_record_stop_replaying (...)\n", debug_target.to_shortname);
+  debug_target.to_record_stop_replaying (&debug_target);
+  fprintf_unfiltered (gdb_stdlog, "<- %s->to_record_stop_replaying (", debug_target.to_shortname);
+  target_debug_print_struct_target_ops_p (&debug_target);
+  fputs_unfiltered (")\n", gdb_stdlog);
+}
+
 static void
 delegate_goto_record_begin (struct target_ops *self)
 {
@@ -4267,6 +4289,8 @@ install_delegators (struct target_ops *ops)
     ops->to_delete_record = delegate_delete_record;
   if (ops->to_record_is_replaying == NULL)
     ops->to_record_is_replaying = delegate_record_is_replaying;
+  if (ops->to_record_stop_replaying == NULL)
+    ops->to_record_stop_replaying = delegate_record_stop_replaying;
   if (ops->to_goto_record_begin == NULL)
     ops->to_goto_record_begin = delegate_goto_record_begin;
   if (ops->to_goto_record_end == NULL)
@@ -4434,6 +4458,7 @@ install_dummy_methods (struct target_ops *ops)
   ops->to_save_record = tdefault_save_record;
   ops->to_delete_record = tdefault_delete_record;
   ops->to_record_is_replaying = tdefault_record_is_replaying;
+  ops->to_record_stop_replaying = tdefault_record_stop_replaying;
   ops->to_goto_record_begin = tdefault_goto_record_begin;
   ops->to_goto_record_end = tdefault_goto_record_end;
   ops->to_goto_record = tdefault_goto_record;
@@ -4587,6 +4612,7 @@ init_debug_target (struct target_ops *ops)
   ops->to_save_record = debug_save_record;
   ops->to_delete_record = debug_delete_record;
   ops->to_record_is_replaying = debug_record_is_replaying;
+  ops->to_record_stop_replaying = debug_record_stop_replaying;
   ops->to_goto_record_begin = debug_goto_record_begin;
   ops->to_goto_record_end = debug_goto_record_end;
   ops->to_goto_record = debug_goto_record;
index 34d57ea8c3b82f3267991c6f310d08f594e736f2..f73067c61a326f828a9f3d527a9c2c2954b811f2 100644 (file)
@@ -3663,6 +3663,14 @@ target_record_is_replaying (ptid_t ptid)
 
 /* See target.h.  */
 
+void
+target_record_stop_replaying (void)
+{
+  current_target.to_record_stop_replaying (&current_target);
+}
+
+/* See target.h.  */
+
 void
 target_goto_record_begin (void)
 {
index 2afeae29037aab70a606bf96fed44b06e5c7fd28..169785dfe267a43be60cd46ce58dd50845211f4e 100644 (file)
@@ -1157,6 +1157,10 @@ struct target_ops
     int (*to_record_is_replaying) (struct target_ops *, ptid_t ptid)
       TARGET_DEFAULT_RETURN (0);
 
+    /* Stop replaying.  */
+    void (*to_record_stop_replaying) (struct target_ops *)
+      TARGET_DEFAULT_IGNORE ();
+
     /* Go to the begin of the execution trace.  */
     void (*to_goto_record_begin) (struct target_ops *)
       TARGET_DEFAULT_NORETURN (tcomplain ());
@@ -2442,6 +2446,9 @@ extern void target_delete_record (void);
 /* See to_record_is_replaying in struct target_ops.  */
 extern int target_record_is_replaying (ptid_t ptid);
 
+/* See to_record_stop_replaying in struct target_ops.  */
+extern void target_record_stop_replaying (void);
+
 /* See to_goto_record_begin in struct target_ops.  */
 extern void target_goto_record_begin (void);