+2020-06-18 Pedro Alves <palves@redhat.com>
+
+ * tracectf.c (ctf_target_open): Switch to added thread instead of
+ writing to inferior_ptid directly.
+ (ctf_target::close): Use switch_to_no_thread instead of writing to
+ inferior_ptid directly.
+
2020-06-18 Pedro Alves <palves@redhat.com>
* tracefile-tfile.c (tfile_target_open): Don't write to
push_target (&ctf_ops);
inferior_appeared (current_inferior (), CTF_PID);
- inferior_ptid = ptid_t (CTF_PID);
- add_thread_silent (&ctf_ops, inferior_ptid);
+
+ thread_info *thr = add_thread_silent (&ctf_ops, ptid_t (CTF_PID));
+ switch_to_thread (thr);
merge_uploaded_trace_state_variables (&uploaded_tsvs);
merge_uploaded_tracepoints (&uploaded_tps);
xfree (trace_dirname);
trace_dirname = NULL;
- inferior_ptid = null_ptid; /* Avoid confusion from thread stuff. */
+ switch_to_no_thread (); /* Avoid confusion from thread stuff. */
exit_inferior_silent (current_inferior ());
trace_reset_local_state ();