From: Markus Metzger <markus.t.metzger@intel.com>
To: palves@redhat.com
Cc: gdb-patches@sourceware.org
Subject: [PATCH 14/17] target, record: add PTID argument to to_record_is_replaying
Date: Wed, 09 Sep 2015 10:35:00 -0000 [thread overview]
Message-ID: <1441794909-32718-15-git-send-email-markus.t.metzger@intel.com> (raw)
In-Reply-To: <1441794909-32718-1-git-send-email-markus.t.metzger@intel.com>
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-09 Markus Metzger <markus.t.metzger@intel.com>
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) <to_record_is_replaying>: 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 f3e6abe..7e1df13 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 ddcad94..ba6c4c6 100644
--- a/gdb/target-delegates.c
+++ b/gdb/target-delegates.c
@@ -3555,26 +3555,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 ea541aa..5f97a65 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -3637,9 +3637,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 37e4edb..877075a 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -1152,8 +1152,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. */
@@ -2424,7 +2424,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
next prev parent reply other threads:[~2015-09-09 10:35 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-09 10:36 [PATCH 00/17] record btrace: non-stop and ASNS Markus Metzger
2015-09-09 10:35 ` [PATCH 15/17] btrace: allow full memory and register access for non-replaying threads Markus Metzger
2015-09-09 11:57 ` Pedro Alves
2015-09-09 10:35 ` [PATCH 05/17] btrace: split record_btrace_step_thread Markus Metzger
2015-09-09 10:35 ` [PATCH 04/17] btrace: extract the breakpoint check from record_btrace_step_thread Markus Metzger
2015-09-09 10:35 ` [PATCH 08/17] btrace: lock-step Markus Metzger
2015-09-09 10:35 ` [PATCH 10/17] btrace: temporarily set inferior_ptid in record_btrace_start_replaying Markus Metzger
2015-09-09 10:35 ` Markus Metzger [this message]
2015-09-09 10:35 ` [PATCH 01/17] btrace: fix non-stop check in to_wait Markus Metzger
2015-09-09 10:35 ` [PATCH 12/17] infrun: switch to NO_HISTORY thread Markus Metzger
2015-09-09 10:35 ` [PATCH 11/17] btrace: async Markus Metzger
2015-09-09 10:35 ` [PATCH 03/17] btrace: improve stepping debugging Markus Metzger
2015-09-09 10:36 ` [PATCH 02/17] btrace: support to_stop Markus Metzger
2015-09-09 10:36 ` [PATCH 13/17] btrace: non-stop Markus Metzger
2015-09-09 11:54 ` Pedro Alves
2015-09-09 12:20 ` Metzger, Markus T
2015-09-09 13:47 ` Pedro Alves
2015-09-09 14:10 ` Metzger, Markus T
2015-09-09 14:51 ` Pedro Alves
2015-09-10 7:49 ` Metzger, Markus T
2015-09-10 11:05 ` Pedro Alves
2015-09-10 11:19 ` Metzger, Markus T
2015-09-10 11:32 ` Pedro Alves
2015-09-10 11:37 ` Metzger, Markus T
2015-09-10 12:48 ` Pedro Alves
2015-09-09 10:36 ` [PATCH 09/17] btrace: resume all requested threads Markus Metzger
2015-09-09 12:06 ` Pedro Alves
2015-09-09 13:06 ` Metzger, Markus T
2015-09-09 10:36 ` [PATCH 17/17] infrun: scheduler-locking reverse Markus Metzger
2015-09-09 13:54 ` Pedro Alves
2015-09-12 19:43 ` Jan Kratochvil
2015-09-15 9:29 ` Metzger, Markus T
2015-09-15 17:19 ` Jan Kratochvil
2015-09-16 7:59 ` Metzger, Markus T
2015-09-16 12:44 ` Metzger, Markus T
2015-09-16 13:23 ` Pedro Alves
2015-09-16 13:21 ` Pedro Alves
2015-09-17 8:39 ` Jan Kratochvil
2015-09-17 8:48 ` Metzger, Markus T
2015-09-17 10:11 ` Eli Zaretskii
2015-09-09 10:36 ` [PATCH 07/17] btrace: add missing NO_HISTORY Markus Metzger
2015-09-09 10:36 ` [PATCH 06/17] btrace: move breakpoint checking into stepping functions Markus Metzger
2015-09-09 10:36 ` [PATCH 16/17] target: add to_record_stop_replaying target method Markus Metzger
2015-09-09 11:59 ` Pedro Alves
2015-09-09 13:56 ` [PATCH 00/17] record btrace: non-stop and ASNS Pedro Alves
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=1441794909-32718-15-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