From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20813 invoked by alias); 9 Sep 2015 10:36:02 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 20577 invoked by uid 89); 9 Sep 2015 10:36:02 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: mga03.intel.com Received: from mga03.intel.com (HELO mga03.intel.com) (134.134.136.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 09 Sep 2015 10:35:54 +0000 Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP; 09 Sep 2015 03:35:22 -0700 X-ExtLoop1: 1 Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga003.jf.intel.com with ESMTP; 09 Sep 2015 03:35:20 -0700 Received: from ulvlx001.iul.intel.com (ulvlx001.iul.intel.com [172.28.207.17]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id t89AZEA6004768; Wed, 9 Sep 2015 11:35:20 +0100 Received: from ulvlx001.iul.intel.com (localhost [127.0.0.1]) by ulvlx001.iul.intel.com with ESMTP id t89AZEG9000643; Wed, 9 Sep 2015 12:35:14 +0200 Received: (from mmetzger@localhost) by ulvlx001.iul.intel.com with œ id t89AZEes000636; Wed, 9 Sep 2015 12:35:14 +0200 From: Markus Metzger To: palves@redhat.com Cc: gdb-patches@sourceware.org Subject: [PATCH 16/17] target: add to_record_stop_replaying target method Date: Wed, 09 Sep 2015 10:36:00 -0000 Message-Id: <1441794909-32718-17-git-send-email-markus.t.metzger@intel.com> In-Reply-To: <1441794909-32718-1-git-send-email-markus.t.metzger@intel.com> References: <1441794909-32718-1-git-send-email-markus.t.metzger@intel.com> X-IsSubscribed: yes X-SW-Source: 2015-09/txt/msg00119.txt.bz2 Add a new target method to_record_stop_replaying to stop replaying. 2015-09-09 Markus Metzger 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) : 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 e5aabd0..c0e6c73 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 ba6c4c6..ed4ac21 100644 --- a/gdb/target-delegates.c +++ b/gdb/target-delegates.c @@ -3584,6 +3584,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; @@ -4216,6 +4238,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) @@ -4381,6 +4405,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; @@ -4532,6 +4557,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 5f97a65..add6119 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -3645,6 +3645,14 @@ target_record_is_replaying (ptid_t ptid) /* See target.h. */ void +target_record_stop_replaying (void) +{ + return 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 877075a..d8ead97 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -1156,6 +1156,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