This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 13/15] record-btrace: add to_wait and to_resume target methods.
- From: Markus Metzger <markus dot t dot metzger at intel dot com>
- To: jan dot kratochvil at redhat dot com
- Cc: gdb-patches at sourceware dot org
- Date: Thu, 2 May 2013 14:03:34 +0200
- Subject: [PATCH 13/15] record-btrace: add to_wait and to_resume target methods.
- References: <1367496216-21217-1-git-send-email-markus dot t dot metzger at intel dot com>
Add simple to_wait and to_resume target methods that prevent stepping when the
current replay position is not at the end of the execution log.
2013-05-02 Markus Metzger <markus.t.metzger@intel.com>
* record-btrace.c (record_btrace_resume): New.
(record_btrace_wait): New.
(init_record_btrace_ops): Initialize to_wait and to_resume.
---
gdb/record-btrace.c | 43 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 43 insertions(+), 0 deletions(-)
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index cd17c77..a16e7ea 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -1006,6 +1006,47 @@ static const struct frame_unwind record_btrace_frame_unwind =
NULL,
record_btrace_frame_sniffer
};
+
+/* The to_resume method of target record-btrace. */
+
+static void
+record_btrace_resume (struct target_ops *ops, ptid_t ptid, int step,
+ enum gdb_signal signal)
+{
+ struct thread_info *tp;
+ struct target_ops *t;
+
+ if (record_btrace_is_replaying ())
+ error (_("You can't do this from here. Do 'record goto end', first."));
+
+ for (t = ops->beneath; t != NULL; t = t->beneath)
+ if (t->to_resume != NULL)
+ break;
+
+ if (t == NULL)
+ error (_("Cannot find target for stepping."));
+
+ t->to_resume (t, ptid, step, signal);
+}
+
+/* The to_wait method of target record-btrace. */
+
+static ptid_t
+record_btrace_wait (struct target_ops *ops, ptid_t ptid,
+ struct target_waitstatus *status, int options)
+{
+ struct target_ops *t;
+
+ for (t = ops->beneath; t != NULL; t = t->beneath)
+ if (t->to_wait != NULL)
+ break;
+
+ if (t == NULL)
+ error (_("Cannot find target for stepping."));
+
+ return t->to_wait (t, ptid, status, options);
+}
+
/* Initialize the record-btrace target ops. */
static void
@@ -1038,6 +1079,8 @@ init_record_btrace_ops (void)
ops->to_store_registers = record_btrace_store_registers;
ops->to_prepare_to_store = record_btrace_prepare_to_store;
ops->to_get_unwinder = &record_btrace_frame_unwind;
+ ops->to_resume = record_btrace_resume;
+ ops->to_wait = record_btrace_wait;
ops->to_stratum = record_stratum;
ops->to_magic = OPS_MAGIC;
}
--
1.7.1