From: Markus Metzger <markus.t.metzger@intel.com>
To: palves@redhat.com
Cc: gdb-patches@sourceware.org
Subject: [PATCH v2 16/17] target: add to_record_stop_replaying target method
Date: Fri, 11 Sep 2015 06:52:00 -0000 [thread overview]
Message-ID: <1441954298-25298-17-git-send-email-markus.t.metzger@intel.com> (raw)
In-Reply-To: <1441954298-25298-1-git-send-email-markus.t.metzger@intel.com>
Add a new target method to_record_stop_replaying to stop replaying.
2015-09-11 Markus Metzger <markus.t.metzger@intel.com>
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/record-btrace.c | 15 +++++++++++++--
gdb/record-full.c | 9 +++++++++
gdb/target-delegates.c | 26 ++++++++++++++++++++++++++
gdb/target.c | 8 ++++++++
gdb/target.h | 7 +++++++
5 files changed, 63 insertions(+), 2 deletions(-)
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index b4e4560..e0b79a8 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -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;
diff --git a/gdb/record-full.c b/gdb/record-full.c
index 03dc22d..35b3841 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -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;
diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c
index dda817f..f570be1 100644
--- a/gdb/target-delegates.c
+++ b/gdb/target-delegates.c
@@ -3578,6 +3578,28 @@ debug_record_is_replaying (struct target_ops *self, ptid_t arg1)
}
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)
{
self = self->beneath;
@@ -4210,6 +4232,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)
@@ -4375,6 +4399,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;
@@ -4526,6 +4551,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;
diff --git a/gdb/target.c b/gdb/target.c
index 4b19602..0a393b3 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -3656,6 +3656,14 @@ target_record_is_replaying (ptid_t ptid)
/* See target.h. */
void
+target_record_stop_replaying (void)
+{
+ current_target.to_record_stop_replaying (¤t_target);
+}
+
+/* See target.h. */
+
+void
target_goto_record_begin (void)
{
current_target.to_goto_record_begin (¤t_target);
diff --git a/gdb/target.h b/gdb/target.h
index 1ba1941..926ee15 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -1149,6 +1149,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 ());
@@ -2426,6 +2430,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);
--
1.8.3.1
next prev parent reply other threads:[~2015-09-11 6:52 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-11 6:52 [PATCH v2 00/17] record btrace: non-stop and ASNS Markus Metzger
2015-09-11 6:51 ` [PATCH v2 01/17] btrace: fix non-stop check in to_wait Markus Metzger
2015-09-11 6:51 ` [PATCH v2 08/17] btrace: lock-step Markus Metzger
2015-09-11 6:51 ` [PATCH v2 11/17] btrace: async Markus Metzger
2015-09-11 6:51 ` [PATCH v2 04/17] btrace: extract the breakpoint check from record_btrace_step_thread Markus Metzger
2015-09-11 6:51 ` [PATCH v2 12/17] infrun: switch to NO_HISTORY thread Markus Metzger
2015-09-11 6:51 ` [PATCH v2 07/17] btrace: add missing NO_HISTORY Markus Metzger
2015-09-11 6:51 ` [PATCH v2 06/17] btrace: move breakpoint checking into stepping functions Markus Metzger
2015-09-11 6:51 ` [PATCH v2 05/17] btrace: split record_btrace_step_thread Markus Metzger
2015-09-11 6:51 ` [PATCH v2 03/17] btrace: improve stepping debugging Markus Metzger
2015-09-11 6:52 ` [PATCH v2 14/17] target, record: add PTID argument to to_record_is_replaying Markus Metzger
2015-09-11 6:52 ` [PATCH v2 13/17] btrace: non-stop Markus Metzger
2015-09-11 6:58 ` Eli Zaretskii
2015-09-11 6:52 ` Markus Metzger [this message]
2015-09-11 6:52 ` [PATCH v2 15/17] btrace: allow full memory and register access for non-replaying threads Markus Metzger
2015-09-11 6:52 ` [PATCH v2 10/17] btrace: temporarily set inferior_ptid in record_btrace_start_replaying Markus Metzger
2015-09-11 6:52 ` [PATCH v2 02/17] btrace: support to_stop Markus Metzger
2015-09-11 6:52 ` [PATCH v2 17/17] infrun: scheduler-locking reverse Markus Metzger
2015-09-11 7:01 ` Eli Zaretskii
2015-09-11 8:55 ` Pedro Alves
2015-09-11 9:02 ` Eli Zaretskii
2015-09-16 12:28 ` Metzger, Markus T
2015-09-16 12:54 ` Pedro Alves
2015-09-16 13:32 ` Pedro Alves
2015-09-16 13:56 ` Metzger, Markus T
2015-09-16 14:25 ` Pedro Alves
2015-09-11 6:52 ` [PATCH v2 09/17] btrace: resume all requested threads Markus Metzger
2015-09-11 7:56 ` [PATCH v2 00/17] record btrace: non-stop and ASNS Pedro Alves
2015-09-11 8:02 ` Metzger, Markus T
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1441954298-25298-17-git-send-email-markus.t.metzger@intel.com \
--to=markus.t.metzger@intel.com \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).