summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2020-04-13 20:02:22 +0100
committerPedro Alves <palves@redhat.com>2020-06-03 20:31:16 +0100
commit4c291399f2e448f5847ea46822c64c39b6a2f7f4 (patch)
treec3e9fdf1c764edd94367db14be9d0135c160e452
parent8867ea40c2e5c78d975c3e5140b81c7083f6653e (diff)
downloadbinutils-gdb-4c291399f2e448f5847ea46822c64c39b6a2f7f4.tar.gz
Don't write to inferior_ptid in btrace_fetch
gdb/ChangeLog: yyyy-mm-dd Pedro Alves <palves@redhat.com> * btrace.c (btrace_fetch): Use switch_to_thread instead of writing to inferior_ptid.
-rw-r--r--gdb/btrace.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/gdb/btrace.c b/gdb/btrace.c
index d41e3c4f8f9..2a0c61de766 100644
--- a/gdb/btrace.c
+++ b/gdb/btrace.c
@@ -1910,11 +1910,12 @@ btrace_fetch (struct thread_info *tp, const struct btrace_cpu *cpu)
if (btinfo->replay != NULL)
return;
- /* With CLI usage, TP->PTID always equals INFERIOR_PTID here. Now that we
- can store a gdb.Record object in Python referring to a different thread
- than the current one, temporarily set INFERIOR_PTID. */
- scoped_restore save_inferior_ptid = make_scoped_restore (&inferior_ptid);
- inferior_ptid = tp->ptid;
+ /* With CLI usage, TP is always the current thread when we get here.
+ However, since we can also store a gdb.Record object in Python
+ referring to a different thread than the current one, we need to
+ temporarily set the current thread. */
+ scoped_restore_current_thread restore_thread;
+ switch_to_thread (tp);
/* We should not be called on running or exited threads. */
gdb_assert (can_access_registers_thread (tp));