diff options
author | Pedro Alves <palves@redhat.com> | 2020-06-18 21:28:31 +0100 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2020-06-18 23:14:15 +0100 |
commit | 86e57d1b233e15f7d72b39dbd381a7e5a9d1b026 (patch) | |
tree | 0094629c8282029d0f9d36f30820abb4212858ad | |
parent | f2e1c129f8f0985ec80e6cf775cf3e4afbced6fa (diff) | |
download | gdb-86e57d1b233e15f7d72b39dbd381a7e5a9d1b026.zip gdb-86e57d1b233e15f7d72b39dbd381a7e5a9d1b026.tar.gz gdb-86e57d1b233e15f7d72b39dbd381a7e5a9d1b026.tar.bz2 |
Don't write to inferior_ptid in btrace_fetch
gdb/ChangeLog:
2020-06-18 Pedro Alves <palves@redhat.com>
* btrace.c (btrace_fetch): Use switch_to_thread instead of writing
to inferior_ptid.
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/btrace.c | 11 |
2 files changed, 11 insertions, 5 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index c465a4d..2f3c1e5 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2020-06-18 Pedro Alves <palves@redhat.com> + * btrace.c (btrace_fetch): Use switch_to_thread instead of writing + to inferior_ptid. + +2020-06-18 Pedro Alves <palves@redhat.com> + * bsd-kvm.c (bsd_kvm_target::close): Use switch_to_no_thread instead of writing to inferior_ptid directly. diff --git a/gdb/btrace.c b/gdb/btrace.c index d41e3c4..2a0c61d 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)); |