From: Markus Metzger Date: Tue, 8 Sep 2015 06:26:16 +0000 (+0200) Subject: target, record: add PTID argument to to_record_is_replaying X-Git-Tag: users/ARM/embedded-binutils-2_26-branch-2016q1~650 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a52eab48080f29feaa56421481cfea221ee6346e;p=external%2Fbinutils.git target, record: add PTID argument to to_record_is_replaying 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. 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. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 214e6b0..db5386e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,18 @@ 2015-09-18 Markus Metzger + * 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. + +2015-09-18 Markus Metzger + * record-btrace.c (record_btrace_open): Remove non_stop check. * NEWS: Announce that record btrace supports non-stop mode. 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);