From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 69330 invoked by alias); 17 Sep 2015 14:10:25 -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 68160 invoked by uid 89); 17 Sep 2015 14:10:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: mga02.intel.com Received: from mga02.intel.com (HELO mga02.intel.com) (134.134.136.20) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 17 Sep 2015 14:09:58 +0000 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 17 Sep 2015 07:09:57 -0700 X-ExtLoop1: 1 Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga001.jf.intel.com with ESMTP; 17 Sep 2015 07:09:56 -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 t8HE9t6S001542; Thu, 17 Sep 2015 15:09:55 +0100 Received: from ulvlx001.iul.intel.com (localhost [127.0.0.1]) by ulvlx001.iul.intel.com with ESMTP id t8HE9t8A001597; Thu, 17 Sep 2015 16:09:55 +0200 Received: (from mmetzger@localhost) by ulvlx001.iul.intel.com with œ id t8HE9t9N001593; Thu, 17 Sep 2015 16:09:55 +0200 From: Markus Metzger To: palves@redhat.com Cc: gdb-patches@sourceware.org Subject: [PATCH v3 14/19] target, record: add PTID argument to to_record_is_replaying Date: Thu, 17 Sep 2015 14:10:00 -0000 Message-Id: <1442498990-1222-15-git-send-email-markus.t.metzger@intel.com> In-Reply-To: <1442498990-1222-1-git-send-email-markus.t.metzger@intel.com> References: <1442498990-1222-1-git-send-email-markus.t.metzger@intel.com> X-IsSubscribed: yes X-SW-Source: 2015-09/txt/msg00417.txt.bz2 The to_record_is_replaying target method is used to query record targets if they are replaying. This is currently interpreted as "is any thread being replayed". Add a PTID argument and change the interpretation to "is any thread matching PTID being replayed". Change all users to pass minus_one_ptid to preserve the old meaning. The record full target does not really support multi-threading and ignores the PTID argument. 2015-09-17 Markus Metzger gdb/ * record-btrace.c (record_btrace_is_replaying): Add ptid argument. Update users to pass minus_one_ptid. * record-full.c (record_full_is_replaying): Add ptid argument (ignored). * record.c (cmd_record_delete): Pass inferior_ptid to target_record_is_replaying. * target-delegates.c: Regenerated. * target.c (target_record_is_replaying): Add ptid argument. * target.h (struct target_ops) : Add ptid argument. (target_record_is_replaying): Add ptid argument. --- gdb/record-btrace.c | 33 +++++++++++++++++++-------------- gdb/record-full.c | 2 +- gdb/record.c | 2 +- gdb/target-delegates.c | 12 +++++++----- gdb/target.c | 4 ++-- gdb/target.h | 6 +++--- 6 files changed, 33 insertions(+), 26 deletions(-) diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c index 8eefae2..481d22d 100644 --- a/gdb/record-btrace.c +++ b/gdb/record-btrace.c @@ -1136,12 +1136,12 @@ record_btrace_call_history_from (struct target_ops *self, /* The to_record_is_replaying method of target record-btrace. */ static int -record_btrace_is_replaying (struct target_ops *self) +record_btrace_is_replaying (struct target_ops *self, ptid_t ptid) { struct thread_info *tp; ALL_NON_EXITED_THREADS (tp) - if (btrace_is_replaying (tp)) + if (ptid_match (tp->ptid, ptid) && btrace_is_replaying (tp)) return 1; return 0; @@ -1160,7 +1160,7 @@ record_btrace_xfer_partial (struct target_ops *ops, enum target_object object, /* Filter out requests that don't make sense during replay. */ if (replay_memory_access == replay_memory_access_read_only && !record_btrace_generating_corefile - && record_btrace_is_replaying (ops)) + && record_btrace_is_replaying (ops, minus_one_ptid)) { switch (object) { @@ -1313,7 +1313,8 @@ record_btrace_store_registers (struct target_ops *ops, { struct target_ops *t; - if (!record_btrace_generating_corefile && record_btrace_is_replaying (ops)) + if (!record_btrace_generating_corefile + && record_btrace_is_replaying (ops, minus_one_ptid)) error (_("This record target does not allow writing registers.")); gdb_assert (may_write_registers != 0); @@ -1330,7 +1331,8 @@ record_btrace_prepare_to_store (struct target_ops *ops, { struct target_ops *t; - if (!record_btrace_generating_corefile && record_btrace_is_replaying (ops)) + if (!record_btrace_generating_corefile + && record_btrace_is_replaying (ops, minus_one_ptid)) return; t = ops->beneath; @@ -1917,7 +1919,8 @@ record_btrace_resume (struct target_ops *ops, ptid_t ptid, int step, For non-stop targets this means that no thread is replaying. In order to make progress, we may need to explicitly move replaying threads to the end of their execution history. */ - if (!record_btrace_is_replaying (ops) && execution_direction != EXEC_REVERSE) + if ((execution_direction != EXEC_REVERSE) + && !record_btrace_is_replaying (ops, minus_one_ptid)) { ops = ops->beneath; return ops->to_resume (ops, orig_ptid, step, signal); @@ -2273,7 +2276,8 @@ record_btrace_wait (struct target_ops *ops, ptid_t ptid, DEBUG ("wait %s (0x%x)", target_pid_to_str (ptid), options); /* As long as we're not replaying, just forward the request. */ - if (!record_btrace_is_replaying (ops) && execution_direction != EXEC_REVERSE) + if ((execution_direction != EXEC_REVERSE) + && !record_btrace_is_replaying (ops, minus_one_ptid)) { ops = ops->beneath; return ops->to_wait (ops, ptid, status, options); @@ -2401,7 +2405,8 @@ record_btrace_stop (struct target_ops *ops, ptid_t ptid) DEBUG ("stop %s", target_pid_to_str (ptid)); /* As long as we're not replaying, just forward the request. */ - if (!record_btrace_is_replaying (ops) && execution_direction != EXEC_REVERSE) + if ((execution_direction != EXEC_REVERSE) + && !record_btrace_is_replaying (ops, minus_one_ptid)) { ops = ops->beneath; ops->to_stop (ops, ptid); @@ -2432,7 +2437,7 @@ record_btrace_can_execute_reverse (struct target_ops *self) static int record_btrace_stopped_by_sw_breakpoint (struct target_ops *ops) { - if (record_btrace_is_replaying (ops)) + if (record_btrace_is_replaying (ops, minus_one_ptid)) { struct thread_info *tp = inferior_thread (); @@ -2448,7 +2453,7 @@ record_btrace_stopped_by_sw_breakpoint (struct target_ops *ops) static int record_btrace_supports_stopped_by_sw_breakpoint (struct target_ops *ops) { - if (record_btrace_is_replaying (ops)) + if (record_btrace_is_replaying (ops, minus_one_ptid)) return 1; return ops->beneath->to_supports_stopped_by_sw_breakpoint (ops->beneath); @@ -2459,7 +2464,7 @@ record_btrace_supports_stopped_by_sw_breakpoint (struct target_ops *ops) static int record_btrace_stopped_by_hw_breakpoint (struct target_ops *ops) { - if (record_btrace_is_replaying (ops)) + if (record_btrace_is_replaying (ops, minus_one_ptid)) { struct thread_info *tp = inferior_thread (); @@ -2475,7 +2480,7 @@ record_btrace_stopped_by_hw_breakpoint (struct target_ops *ops) static int record_btrace_supports_stopped_by_hw_breakpoint (struct target_ops *ops) { - if (record_btrace_is_replaying (ops)) + if (record_btrace_is_replaying (ops, minus_one_ptid)) return 1; return ops->beneath->to_supports_stopped_by_hw_breakpoint (ops->beneath); @@ -2487,7 +2492,7 @@ static void record_btrace_update_thread_list (struct target_ops *ops) { /* We don't add or remove threads during replay. */ - if (record_btrace_is_replaying (ops)) + if (record_btrace_is_replaying (ops, minus_one_ptid)) return; /* Forward the request. */ @@ -2501,7 +2506,7 @@ static int record_btrace_thread_alive (struct target_ops *ops, ptid_t ptid) { /* We don't add or remove threads during replay. */ - if (record_btrace_is_replaying (ops)) + if (record_btrace_is_replaying (ops, minus_one_ptid)) return find_thread_ptid (ptid) != NULL; /* Forward the request. */ diff --git a/gdb/record-full.c b/gdb/record-full.c index 06bfdb8..03dc22d 100644 --- a/gdb/record-full.c +++ b/gdb/record-full.c @@ -1840,7 +1840,7 @@ record_full_delete (struct target_ops *self) /* The "to_record_is_replaying" target method. */ static int -record_full_is_replaying (struct target_ops *self) +record_full_is_replaying (struct target_ops *self, ptid_t ptid) { return RECORD_FULL_IS_REPLAY; } diff --git a/gdb/record.c b/gdb/record.c index ad83a29..71ef973 100644 --- a/gdb/record.c +++ b/gdb/record.c @@ -234,7 +234,7 @@ cmd_record_delete (char *args, int from_tty) { require_record_target (); - if (!target_record_is_replaying ()) + if (!target_record_is_replaying (inferior_ptid)) { printf_unfiltered (_("Already at end of record list.\n")); return; diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c index c358814..9f909a0 100644 --- a/gdb/target-delegates.c +++ b/gdb/target-delegates.c @@ -3602,26 +3602,28 @@ debug_delete_record (struct target_ops *self) } static int -delegate_record_is_replaying (struct target_ops *self) +delegate_record_is_replaying (struct target_ops *self, ptid_t arg1) { self = self->beneath; - return self->to_record_is_replaying (self); + return self->to_record_is_replaying (self, arg1); } static int -tdefault_record_is_replaying (struct target_ops *self) +tdefault_record_is_replaying (struct target_ops *self, ptid_t arg1) { return 0; } static int -debug_record_is_replaying (struct target_ops *self) +debug_record_is_replaying (struct target_ops *self, ptid_t arg1) { int result; fprintf_unfiltered (gdb_stdlog, "-> %s->to_record_is_replaying (...)\n", debug_target.to_shortname); - result = debug_target.to_record_is_replaying (&debug_target); + result = debug_target.to_record_is_replaying (&debug_target, arg1); fprintf_unfiltered (gdb_stdlog, "<- %s->to_record_is_replaying (", debug_target.to_shortname); target_debug_print_struct_target_ops_p (&debug_target); + fputs_unfiltered (", ", gdb_stdlog); + target_debug_print_ptid_t (arg1); fputs_unfiltered (") = ", gdb_stdlog); target_debug_print_int (result); fputs_unfiltered ("\n", gdb_stdlog); diff --git a/gdb/target.c b/gdb/target.c index f425fbc..34d57ea 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -3656,9 +3656,9 @@ target_delete_record (void) /* See target.h. */ int -target_record_is_replaying (void) +target_record_is_replaying (ptid_t ptid) { - return current_target.to_record_is_replaying (¤t_target); + return current_target.to_record_is_replaying (¤t_target, ptid); } /* See target.h. */ diff --git a/gdb/target.h b/gdb/target.h index 2875ad4..2afeae2 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -1153,8 +1153,8 @@ struct target_ops void (*to_delete_record) (struct target_ops *) TARGET_DEFAULT_NORETURN (tcomplain ()); - /* Query if the record target is currently replaying. */ - int (*to_record_is_replaying) (struct target_ops *) + /* Query if the record target is currently replaying PTID. */ + int (*to_record_is_replaying) (struct target_ops *, ptid_t ptid) TARGET_DEFAULT_RETURN (0); /* Go to the begin of the execution trace. */ @@ -2440,7 +2440,7 @@ extern int target_supports_delete_record (void); extern void target_delete_record (void); /* See to_record_is_replaying in struct target_ops. */ -extern int target_record_is_replaying (void); +extern int target_record_is_replaying (ptid_t ptid); /* See to_goto_record_begin in struct target_ops. */ extern void target_goto_record_begin (void); -- 1.8.3.1